ReferenceMCP Methods

MCP Methods Reference

Complete reference for all Model Context Protocol methods exposed by MA²D servers.

Overview

MCP defines a set of JSON-RPC 2.0 methods for interacting with servers. All methods follow the same request/response pattern.

Method List

MethodDescriptionParametersReturns
initializeNegotiate capabilitiesclientInfo, capabilitiesserverInfo, capabilities
tools/listList available toolsnoneArray of tools
tools/callExecute a toolname, argumentsTool result
resources/listList available resourcesnoneArray of resources
resources/readRead resource contenturiResource content
prompts/listList available promptsnoneArray of prompts
prompts/getGet prompt templatename, argumentsPrompt with messages

initialize

Negotiate protocol capabilities between client and server.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "clientInfo": {
      "name": "my-client",
      "version": "1.0.0"
    },
    "capabilities": {}
  }
}

Parameters

  • protocolVersion (string, required) - MCP protocol version
  • clientInfo (object, required)
    • name (string) - Client name
    • version (string) - Client version
  • capabilities (object, optional) - Client capabilities

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2024-11-05",
    "serverInfo": {
      "name": "weather-api",
      "version": "1.0.0"
    },
    "capabilities": {
      "tools": {},
      "resources": {},
      "prompts": {}
    }
  }
}

Response Fields

  • protocolVersion - Server’s protocol version
  • serverInfo - Server metadata
  • capabilities - What the server supports

tools/list

Retrieve all available tools from the server.

Request

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

Parameters

None

Response

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "get_weather",
        "description": "Get current weather conditions for a city",
        "inputSchema": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string",
              "description": "City name"
            },
            "units": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["city"]
        }
      }
    ]
  }
}

Response Fields

  • tools (array) - List of available tools
    • name - Tool identifier
    • description - What the tool does
    • inputSchema - JSON Schema for parameters

tools/call

Execute a specific tool with provided arguments.

Request

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "get_weather",
    "arguments": {
      "city": "San Francisco",
      "units": "fahrenheit"
    }
  }
}

Parameters

  • name (string, required) - Tool name to execute
  • arguments (object, required) - Tool parameters

Response

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"city\":\"San Francisco\",\"temperature\":65,\"units\":\"fahrenheit\",\"conditions\":\"Partly cloudy\"}"
      }
    ]
  }
}

Response Fields

  • content (array) - Tool execution results
    • type - Content type (text, image, resource)
    • text - Content data (for text type)

resources/list

Get all available resources from the server.

Request

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "resources/list"
}

Parameters

None

Response

{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "resources": [
      {
        "uri": "weather://cities/supported",
        "name": "Supported Cities",
        "description": "List of cities with weather data",
        "mimeType": "application/json"
      }
    ]
  }
}

Response Fields

  • resources (array) - Available resources
    • uri - Resource identifier
    • name - Human-readable name
    • description - Resource description
    • mimeType - Content type

resources/read

Read the content of a specific resource.

Request

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "resources/read",
  "params": {
    "uri": "weather://cities/supported"
  }
}

Parameters

  • uri (string, required) - Resource URI to read

Response

{
  "jsonrpc": "2.0",
  "id": 5,
  "result": {
    "contents": [
      {
        "uri": "weather://cities/supported",
        "mimeType": "application/json",
        "text": "{\"cities\":[{\"name\":\"San Francisco\",\"country\":\"USA\"}]}"
      }
    ]
  }
}

Response Fields

  • contents (array) - Resource content
    • uri - Resource URI
    • mimeType - Content type
    • text - Resource data

prompts/list

List all available prompt templates.

Request

{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "prompts/list"
}

Parameters

None

Response

{
  "jsonrpc": "2.0",
  "id": 6,
  "result": {
    "prompts": [
      {
        "name": "weather_query",
        "description": "Generate weather query prompt",
        "arguments": [
          {
            "name": "city",
            "description": "City to query",
            "required": true
          }
        ]
      }
    ]
  }
}

Response Fields

  • prompts (array) - Available prompts
    • name - Prompt identifier
    • description - Prompt purpose
    • arguments - Required parameters

prompts/get

Get a specific prompt with argument substitution.

Request

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "prompts/get",
  "params": {
    "name": "weather_query",
    "arguments": {
      "city": "San Francisco"
    }
  }
}

Parameters

  • name (string, required) - Prompt name
  • arguments (object, optional) - Prompt arguments

Response

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "description": "Weather query for San Francisco",
    "messages": [
      {
        "role": "user",
        "content": {
          "type": "text",
          "text": "What's the weather in San Francisco?"
        }
      }
    ]
  }
}

Response Fields

  • description - Prompt description
  • messages - Array of message objects
    • role - Message role (user/assistant/system)
    • content - Message content

Error Responses

All methods can return errors following JSON-RPC 2.0:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": {
      "details": "Missing required parameter: city"
    }
  }
}

Standard Error Codes

CodeNameDescription
-32700Parse errorInvalid JSON
-32600Invalid requestMalformed JSON-RPC
-32601Method not foundUnknown method
-32602Invalid paramsBad parameters
-32603Internal errorServer error
-32001UnauthorizedAuthentication failed

See MCP Endpoints for endpoint details.

Protocol Compliance

MA²D servers follow MCP specification 2024-11-05:

  • ✅ JSON-RPC 2.0 format
  • ✅ HTTP-Streamable transport
  • ✅ Server-Sent Events (SSE)
  • ✅ All required methods
  • ✅ Standard error codes
  • ✅ JSON Schema validation

Best Practices

Request IDs

Use unique, incrementing IDs:

let requestId = 1
const request = {
  jsonrpc: '2.0',
  id: requestId++,
  method: 'tools/list'
}

Parameter Validation

Validate against input schemas:

import Ajv from 'ajv'
 
const ajv = new Ajv()
const validate = ajv.compile(tool.inputSchema)
 
if (!validate(arguments)) {
  throw new Error(ajv.errorsText(validate.errors))
}

Error Handling

Always check for errors:

const data = await response.json()
 
if (data.error) {
  console.error(`Error ${data.error.code}: ${data.error.message}`)
  return
}
 
processResult(data.result)

Next Steps

External Resources


Reference Version: MCP 2024-11-05
Last Updated: January 2026