Skip to main content
Glama

mcp_servers

Manage MCP server registry entries and bundle memberships: list, create, update, delete, reconcile ordered tool members, and probe external endpoints with SSRF-guarded discovery.

Instructions

CRUD + bundle-membership for the MCP-server registry (agent_mcp_servers / agent_mcp_tools / agent_profile_mcp_servers): both kinds of server, bundles and external endpoints.

A server row is either source="external" (a live MCP endpoint reached
over transport/endpoint, optionally filtered by the legacy server-level
tool_subset) or source="bundle" (a named group of agent_tools wired via
agent_mcp_tools membership; no endpoint/transport of its own). Built-in
bundles (is_builtin=True) are seeder-managed and read-only here —
update/delete/members all refuse them with the same message the portal
uses. The reserved `__builtin__:` name prefix can't be claimed via
create/update either.

action:
  list — every server (both sources).
  get (mcp_server_id) — the row + `members` (bundle membership, as
    [{tool_id, python_name, position}]) + `attached_count` (profiles
    wired to this server via agent_profile_mcp_servers).
  create (source="bundle"|"external", name, ...) —
    external needs endpoint (+ transport, default "http"; optional
    auth_env_var/tool_subset/context_fields);
    bundle needs name (+ optional usage_guidance/context_fields);
    member_tool_ids seeds agent_mcp_tools membership in the given
    order (validated against non-deprecated agent_tools first).
  update (mcp_server_id + fields) — name/transport/endpoint/
    auth_env_var/usage_guidance/tool_subset/context_fields/is_active.
    Refused for is_builtin rows.
  delete (mcp_server_id, confirm=true) — detaches the id from every
    profile's legacy mcp_server_ids[], deletes its agent_mcp_tools and
    agent_profile_mcp_servers rows, then the server itself. Refused
    for is_builtin rows.
  members (mcp_server_id, member_tool_ids) — reconciles a BUNDLE's
    agent_mcp_tools membership: delete-all then re-insert in the given
    order (position 0..N-1). Only valid for source="bundle"; refused
    for is_builtin rows.
  discover (endpoint, auth_env_var) — live tools/list probe of a
    candidate external endpoint, SSRF-guarded (blocks loopback/
    link-local/cloud-metadata hosts unless MCP_ALLOW_LOCAL_ENDPOINTS
    is set truthy). Read-only — no DB write, no audit. Always returns
    an {"ok": bool, "tools": [...], "error", "error_class"} envelope,
    never raises.

Unknown action: list | get | create | update | delete | members |
discover.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "mcp_servers"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNoConfig branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves.staging
nameNoMCP server name (unique).
actionYesOperation to run: list | get | create | update | delete | members | discover. The tool description lists what each action needs.
sourceNobundle (group of agent_tools) | external (remote MCP endpoint).
confirmNofalse (default) = dry run, nothing changes; true = execute.
endpointNoExternal MCP endpoint URL.
is_activeNoupdate: active flag.
transportNoMCP transport for an external server (e.g. http).
tool_subsetNoOnly these tool names from the MCP (omit = all).
auth_env_varNoEnv var holding the MCP endpoint's token (name only).
mcp_server_idNoagent_mcp_servers UUID (mcp_servers action=list).
context_fieldsNoJSON object of server-side context/credential fields the resolver injects into tool calls.
usage_guidanceNoFree-text guidance rendered to the model next to the tool(s) when bound.
member_tool_idsNoBundle membership: agent_tools ids in order (REPLACES the bundle's members).
timeout_secondsNoTimeout in seconds.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full behavioral burden and does so thoroughly: built-in bundles refuse update/delete/members with the portal's message, the reserved `__builtin__:` prefix can't be claimed, delete cascades through profile mcp_server_ids, agent_mcp_tools and agent_profile_mcp_servers, members is a destructive delete-all-then-reinsert, and discover is SSRF-guarded, write-free and never raises. Those are exactly the traits an agent cannot infer from structured fields.

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

Conciseness4/5

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

The description is long but well front-loaded: a one-line scope statement, then a paragraph on the two server kinds and built-in restrictions, then a consistently formatted per-action list. Nearly every line carries operational detail, though the density of internal table names (agent_mcp_tools, agent_profile_mcp_servers) makes it slower to scan than it needs to be.

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

Completeness5/5

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

For a 15-parameter, seven-action mutation tool with no annotations, this covers the destructive paths, the refusal conditions, and the read-only probe's return envelope. Because an output schema exists, the description is not obliged to explain return shapes, and its mention of the discover envelope is a bonus rather than a gap-filler.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, and the description still adds real meaning: member_tool_ids is order-sensitive and REPLACES membership, tool_subset is a legacy server-level filter, context_fields are injected into tool calls, and confirm=true is required to execute a delete. It loses a point for never mentioning `env` or `timeout_seconds`, which an agent must infer from the schema alone.

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 opens with a specific verb-and-resource statement ('CRUD + bundle-membership for the MCP-server registry') and immediately disambiguates the two row kinds it manages: source="external" live endpoints versus source="bundle" named groups of agent_tools. An agent can tell exactly what domain this tool owns before reading the schema.

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

Usage Guidelines4/5

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

Each action carries its own requirements and constraints (get needs mcp_server_id, create needs endpoint for external or name for bundle, members is only valid for source="bundle"), which is effectively when-to-use guidance per operation. What's missing is routing advice against sibling tools such as `tools` or `profile_mcp_attachments` — it never says which tool to prefer when the boundary is close.

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