Skip to main content
Glama
soriat

MCP Elicitations Demo Server

by soriat

getResourceReference

Retrieve a resource reference for MCP clients by specifying a resource ID (1-100), enabling dynamic user input collection in the MCP Elicitations Demo Server.

Instructions

Returns a resource reference that can be used by MCP clients

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceIdYesID of the resource to reference (1-100)

Implementation Reference

  • The main exported tool object for getResourceReference, including the async handler function that executes the tool logic: validates resourceId, generates all resources, retrieves the specific resource, and returns MCP-formatted content with the resource reference.
    export const getResourceReferenceTool = {
      name: "getResourceReference",
      description: "Returns a resource reference that can be used by MCP clients",
      inputSchema: zodToJsonSchema(GetResourceReferenceSchema),
      handler: async (args: any) => {
        const validatedArgs = GetResourceReferenceSchema.parse(args);
        const resourceId = validatedArgs.resourceId;
    
        const ALL_RESOURCES = generateAllResources();
        const resourceIndex = resourceId - 1;
        if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
          throw new Error(`Resource with ID ${resourceId} does not exist`);
        }
    
        const resource = ALL_RESOURCES[resourceIndex];
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Returning resource reference for Resource ${resourceId}:`,
            },
            {
              type: "resource" as const,
              resource: resource,
            },
            {
              type: "text" as const,
              text: `You can access this resource using the URI: ${resource.uri}`,
            },
          ],
        };
      },
    };
  • Zod schema defining the input for the tool: a number resourceId between 1 and 100.
    const GetResourceReferenceSchema = z.object({
      resourceId: z
        .number()
        .min(1)
        .max(100)
        .describe("ID of the resource to reference (1-100)"),
    });
  • The getResourceReferenceTool is registered by including it in the allTools array, which is used by getTools() to list tools and by getToolHandler() to dispatch calls to the correct handler.
    const allTools = [
      echoTool,
      addTool,
      longRunningOperationTool,
      printEnvTool,
      sampleLlmTool,
      sampleWithPreferencesTool,
      sampleMultimodalTool,
      sampleConversationTool,
      sampleAdvancedTool,
      getTinyImageTool,
      annotatedMessageTool,
      getResourceReferenceTool,
      elicitationTool,
      getResourceLinksTool,
    ];
  • Import of the getResourceReferenceTool from its implementation file.
    import { getResourceReferenceTool } from "./tool-get-resource-reference.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns something but doesn't explain what a 'resource reference' entails (e.g., format, content, or how it's used by MCP clients), whether it's a read-only operation, or any potential side effects. This is inadequate for a tool with no annotation coverage, as it leaves key behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly. Every part of the sentence contributes to the purpose, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a tool that returns a reference with no output schema) and lack of annotations, the description is incomplete. It doesn't explain what the returned 'resource reference' is, how it's structured, or its use cases, leaving gaps in understanding the tool's behavior and output. This is insufficient for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage, clearly documenting the 'resourceId' parameter with its type, range, and requirement. Since the description doesn't elaborate on parameters, it meets the baseline of 3 for high schema coverage without adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Returns a resource reference that can be used by MCP clients', which provides a basic purpose (verb 'returns' + object 'resource reference'). However, it's vague about what a 'resource reference' actually is and doesn't distinguish this from sibling tools like 'getResourceLinks' or 'getTinyImage' that might also return references or resources. The purpose is stated but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention any context, prerequisites, or exclusions, and it doesn't reference sibling tools. This leaves the agent with no information on appropriate usage scenarios, making it rely solely on the tool name and input schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/soriat/soria-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server