Hello World

Be Happy!

MCP Explained: Tool Discovery, Documentation, and API Calls


When an MCP server gives an AI agent a list of tools, is that just documentation? Yes, the list is machine-readable documentation. MCP also provides the protocol for requesting that list, calling a tool, and receiving its result.

API, documentation, and MCP

  • API: operations that software can call.
  • Documentation: explanations of those operations and their inputs.
  • MCP: a standard interface through which an agent's client discovers and invokes tools.

A server can wrap an existing API. It does not need to expose every endpoint as a tool. See the MCP tools specification.

A small example

The following messages illustrate the exchange after the MCP connection has been initialized. The tool name and result are invented examples, not Comfy's actual tool schema.

1. Ask which tools are available

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}

2. Receive the tool descriptions

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "generate_video",
        "description": "Generate a video from an image and prompt.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "image_url": {
              "type": "string"
            },
            "prompt": {
              "type": "string"
            },
            "duration": {
              "type": "number"
            }
          },
          "required": [
            "image_url",
            "prompt"
          ]
        }
      }
    ]
  }
}

name identifies the tool, description explains its purpose, and inputSchema describes valid arguments. That part is documentation the agent can read.

3. Call a tool

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "generate_video",
    "arguments": {
      "image_url": "https://example.com/fox.png",
      "prompt": "The fox girl sings and plays guitar.",
      "duration": 5
    }
  }
}

4. Receive the result

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Generation queued. Job ID: example-job-123"
      }
    ],
    "isError": false
  }
}

This example returns a job ID because video generation can take time. A real service may provide another tool for checking progress and retrieving the finished file.

Who does what?

User asks for a video
  → AI agent chooses a tool
  → MCP client sends tools/call
  → MCP server invokes the generation service
  → Service returns a job or output
  → Agent presents the result

MCP does not generate the video itself. The model or service behind the tool performs the work. Connecting a server also does not automatically grant unlimited access: authentication, permissions, and service billing still apply.

Using Comfy as an example

Comfy provides an MCP connection for finding templates and running workflows. Its official MCP documentation describes the available setup and tools. A workflow can use an image, a prompt, and a video model; the agent retrieves the output through the connection.

The tool list is documentation. MCP is the protocol that delivers the documentation and carries the calls and results.
#mcp (1) #ai-agents (1) #api (1) #comfyui (1)
List