Skip to main content
Glama
DanWahlin

Marvel MCP

by DanWahlin

get_character_by_id

Retrieve detailed Marvel character information using a unique character ID through the Marvel MCP server. Query specific characters for integration into applications or data analysis.

Instructions

Fetch a Marvel character by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
characterIdYes

Implementation Reference

  • The tool handler that parses the input arguments using GetCharacterByIdSchema, fetches the character data from the Marvel API using httpRequest, and parses the response using CharacterDataWrapperSchema.
    handler: async (args: any) => {
        const argsParsed = GetCharacterByIdSchema.parse(args);
        const res = await httpRequest(`/characters/${argsParsed.characterId}`);
        return CharacterDataWrapperSchema.parse(res);
    }
  • Registers the 'get_character_by_id' tool with its description, input schema, and handler function.
    export const get_character_by_id = {
        description: `Fetch a Marvel character by ID.`,
        schema: GetCharacterByIdSchema,
        handler: async (args: any) => {
            const argsParsed = GetCharacterByIdSchema.parse(args);
            const res = await httpRequest(`/characters/${argsParsed.characterId}`);
            return CharacterDataWrapperSchema.parse(res);
        }
    };
  • Zod schema used to parse and validate the response from the Marvel Characters API endpoint.
    export const CharacterDataWrapperSchema = z.object({
      code: z.number(),
      status: z.string(),
      copyright: z.string(),
      attributionText: z.string(),
      attributionHTML: z.string(),
      data: CharacterDataContainerSchema,
      etag: z.string(),
    });
  • Helper utility function that makes authenticated HTTP requests to the Marvel API, handling timestamp, API key, and hash authentication.
    export async function httpRequest(endpoint: string, params: Record<string, string | number | undefined> = {}) {
      const url = new URL(`${MARVEL_API_BASE}${endpoint}`);
    
      const authParams = createAuthParams();
      url.searchParams.set('ts', authParams.ts);
      url.searchParams.set('apikey', authParams.apikey);
      url.searchParams.set('hash', authParams.hash);
    
      for (const [key, value] of Object.entries(params)) {
        if (value !== undefined) {
          url.searchParams.set(key, String(value));
        }
      }
    
      const res = await fetch(url.toString());
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`Marvel API error: ${res.status} - ${text}`);
      }
    
      return res.json();
    }
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 fetches data, implying a read-only operation, but doesn't specify whether it requires authentication, has rate limits, returns errors for invalid IDs, or provides pagination details. For a tool with zero annotation coverage, this is insufficient behavioral context.

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, clear sentence with zero wasted words. It's appropriately sized for a simple lookup tool and front-loaded with the essential action and resource. Every word earns its place, making it highly concise and well-structured.

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 tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't explain what data is returned (e.g., character details, comics list), error handling, or usage context relative to siblings. For a tool in a Marvel API context with multiple related tools, more guidance is needed to be fully helpful.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, so the schema provides no semantic information. The description mentions 'by ID' but doesn't explain what a character ID is (e.g., numeric identifier, format, source). It adds minimal value beyond the schema, failing to compensate for the coverage gap.

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

Purpose4/5

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

The description clearly states the action ('fetch') and resource ('Marvel character by ID'), making the purpose understandable. It distinguishes from siblings like 'get_characters' (which likely fetches multiple characters) by specifying the single-ID lookup. However, it doesn't explicitly mention what data is returned about the character, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose this over 'get_characters' (e.g., for a specific character vs. listing), nor does it address prerequisites like needing a valid character ID. This leaves the agent without contextual usage instructions.

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/DanWahlin/marvel-mcp'

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