Creating Your First Resource

Creating Your First Resource

Resources are information containers that your AI can access and use. Think of them as reference materials that help your AI provide more accurate, consistent, and contextual responses. When your AI needs to format data or access specific information, it can use a resource.

This guide walks you through creating a simple weather response template resource. It's perfect for learning because it's useful, easy to understand, and shows all the key concepts.

What You'll Build

By the end of this guide, you'll have a working resource that provides a consistent format for weather responses. Your AI will be able to use this template to present weather information in a clear, professional way.

Time needed: About 2 minutes

Before You Start

Make sure you have a Ctxpack account and you're logged into the dashboard. If you don't have an account yet, sign up at ctxpack.com.

If you're following along with our weather example, you might want to also create a weather tool and a weather assistant prompt.

Step 1: Navigate to Resources

  1. Open your Ctxpack dashboard
  2. Click "Resources" in the left sidebar
  3. Click "Add Resource" button in the top right

You'll see a form where you can define your resource's content and properties.

create-weather-template-resource.webp

Step 2: Basic Resource Information

Fill in these fields:

Resource URI: ctxpack://templates/weather-response

The URI is a unique identifier for your resource. It's how your AI will reference and access this resource. Use a descriptive path that indicates what the resource is for.

Name: weather-response-template

Keep the name simple and descriptive. This helps you identify the resource in your dashboard.

Type: Select "Text" from the dropdown

Resources can be various types (text, JSON, images, etc.). For our template, we're using simple text with markdown formatting.

Step 3: Define the Resource Content

This is where you provide the actual content of your resource. For our weather response template, we want a consistent format that includes all the important weather information.

In the Content field, enter:

# Weather Report for {city}

**Current Conditions:** {weather_description}

**Temperature:** {temperature}°C (feels like {feels_like}°C)

**Humidity:** {humidity}%

**Wind:** {wind_speed} m/s

*Last updated: {timestamp}*

This template includes placeholders (in curly braces) that your AI will replace with actual weather data. It provides a clean, consistent format for presenting weather information.

Step 4: Set the MIME Type

MIME type: text/markdown

The MIME type tells your AI what kind of content this is. Since we're using markdown formatting, we specify text/markdown.

Step 5: Save Your Resource

Click "Save Resource" to create your resource.

Your resource is now created and ready to use in context packs.

What Just Happened?

You created a template that your AI can use to format weather information consistently. This resource:

  1. Provides a standardized format for presenting weather data
  2. Includes placeholders for dynamic information
  3. Uses markdown formatting for clean, readable output
  4. Can be referenced by your AI whenever it needs to present weather information

Understanding the Components

Resource URI: A unique identifier that your AI uses to access the resource.

Content: The actual information contained in the resource.

Placeholders: Dynamic elements (like {city} or {temperature}) that get replaced with actual data.

MIME Type: Indicates the format of the content (markdown, in this case).

Common Issues and Solutions

AI can't find the resource

  • Make sure the resource URI in your prompt exactly matches the one you defined
  • Check that the resource is included in the same context pack as your prompt and tool
  • Verify that your context pack is active in your AI client

Placeholders aren't being replaced

  • Ensure your AI has access to the data needed to fill the placeholders
  • Check that your prompt correctly instructs the AI to use the data from your tool
  • Verify that the placeholder names match the data fields from your tool

Resource saves but doesn't work in AI clients

Next Steps

Now that you have a working resource, you can:

Add it to a context pack so your AI can actually use it. Resources need to be bundled into packs before AI clients can access them.

Create more resources for different types of information. You could create resources for company policies, product details, or formatting guidelines.

Test it with your AI by adding it to a pack along with a related tool and prompt.

Improve the resource by adding more detailed formatting or additional information.

You can use this same approach to create resources that:

  • Provide brand guidelines for content creation
  • Define response templates for customer service
  • Store reference information about products or services
  • Include formatting rules for various types of content
  • Contain frequently used code snippets or examples