Skip to main content
Glama
rawveg

Ollama MCP Server

ollama_show

Retrieve detailed information about a local Ollama model, including its modelfile, parameters, and architecture. Choose output as JSON or Markdown.

Instructions

Show detailed information about a specific model including modelfile, parameters, and architecture details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesName of the model to show
formatNoOutput format (default: json)json

Implementation Reference

  • This is the main tool definition and handler for 'ollama_show'. It defines the tool name, description, input schema, and the handler function that parses args with ShowModelInputSchema and calls showModel().
    export const toolDefinition: ToolDefinition = {
      name: 'ollama_show',
      description:
        'Show detailed information about a specific model including modelfile, parameters, and architecture details.',
      inputSchema: {
        type: 'object',
        properties: {
          model: {
            type: 'string',
            description: 'Name of the model to show',
          },
          format: {
            type: 'string',
            enum: ['json', 'markdown'],
            description: 'Output format (default: json)',
            default: 'json',
          },
        },
        required: ['model'],
      },
      handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => {
        const validated = ShowModelInputSchema.parse(args);
        return showModel(ollama, validated.model, format);
      },
    };
  • Core business logic: calls ollama.show({model}) and formats the response via formatResponse().
    export async function showModel(
      ollama: Ollama,
      model: string,
      format: ResponseFormat
    ): Promise<string> {
      const response = await ollama.show({ model });
    
      return formatResponse(JSON.stringify(response), format);
    }
  • Zod schema for ollama_show input validation: model (required string) and format (optional, defaults to 'json').
    export const ShowModelInputSchema = z.object({
      model: z.string().min(1),
      format: ResponseFormatSchema.default('json'),
    });
  • src/server.ts:48-123 (registration)
    Server-side registration: discoverTools() loads all toolDefinitions (including ollama_show) and registers them via server.setRequestHandler().
      // Register tool list handler
      server.setRequestHandler(ListToolsRequestSchema, async () => {
        const tools = await discoverTools();
    
        return {
          tools: tools.map((tool) => ({
            name: tool.name,
            description: tool.description,
            inputSchema: tool.inputSchema,
          })),
        };
      });
    
      // Register tool call handler
      server.setRequestHandler(CallToolRequestSchema, async (request) => {
        try {
          const { name, arguments: args } = request.params;
    
          // Discover all tools
          const tools = await discoverTools();
    
          // Find the matching tool
          const tool = tools.find((t) => t.name === name);
    
          if (!tool) {
            throw new Error(`Unknown tool: ${name}`);
          }
    
          // Determine format from args
          const formatArg = (args as Record<string, unknown>).format;
          const format =
            formatArg === 'markdown' ? ResponseFormat.MARKDOWN : ResponseFormat.JSON;
    
          // Call the tool handler
          const result = await tool.handler(
            ollama,
            args as Record<string, unknown>,
            format
          );
    
          // Parse the result to extract structured data
          let structuredData: unknown = undefined;
          try {
            // Attempt to parse the result as JSON
            structuredData = JSON.parse(result);
          } catch {
            // If parsing fails, leave structuredData as undefined
            // This handles cases where the result is markdown or plain text
          }
    
          return {
            structuredContent: structuredData,
            content: [
              {
                type: 'text',
                text: result,
              },
            ],
          };
        } catch (error) {
          const errorMessage =
            error instanceof Error ? error.message : String(error);
          return {
            content: [
              {
                type: 'text',
                text: `Error: ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
      });
    
      return server;
    }
  • Utility used by showModel to format response output as JSON or markdown.
    export function formatResponse(
      content: string,
      format: ResponseFormat
    ): string {
      if (format === ResponseFormat.JSON) {
        // For JSON format, validate and potentially wrap errors
        try {
          // Try to parse to validate it's valid JSON
          JSON.parse(content);
          return content;
        } catch {
          // If not valid JSON, wrap in error object
          return JSON.stringify({
            error: 'Invalid JSON content',
            raw_content: content,
          });
        }
      }
    
      // Format as markdown
      try {
        const data = JSON.parse(content);
        return jsonToMarkdown(data);
      } catch {
        // If not valid JSON, return as-is
        return content;
      }
    }
Behavior4/5

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

No annotations are provided, so the description carries full burden. The verb 'show' strongly implies a read-only operation with no side effects, and the listed details indicate the scope. However, it does not explicitly confirm non-destructiveness or mention any required permissions or rate limits.

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 15-word sentence. It front-loads the action and resource, and every word contributes meaning. No unnecessary details.

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

Completeness4/5

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

For a simple information-retrieval tool with two parameters and no output schema, the description covers the essential purpose and scope. It could specify that the output format is configurable and mention the response style, but the format parameter and sibling context make it adequate.

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?

Schema description coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema for the two parameters ('model' and 'format'). It mentions 'modelfile, parameters, and architecture' but does not tie these to parameters.

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

Purpose5/5

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

The description clearly states the action ('Show detailed information') and the resource ('specific model'), and lists included details (modelfile, parameters, architecture). This distinguishes it from sibling tools like ollama_list (lists models) or ollama_chat (conversation).

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

Usage Guidelines3/5

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

The description implies usage for retrieving model details, but does not explicitly state when to use this tool over alternatives (e.g., ollama_list for brief info, ollama_pull for downloading). No when-not or sibling comparisons are provided.

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

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/rawveg/ollama-mcp'

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