Skip to content

Tag-based tool discovery

Agents and MCPHTTPMCPtagsfindServersByTagsmcpQueryPOST /api/insight/mcp-query

Tag a server when you register it and every tag-scoped agent run picks up its tools, with no workflow code naming the server.

The situation

The tool inventory grows every month: a database server, a browser, a carrier API. An agent run should see the tools that fit its task, and a newly registered server should join without a code change.

The recipe

Tag the server at registration:

register a server
curl -X POST https://lt.acme.dev/api/mcp/servers \
-H "Authorization: Bearer $LT_TOKEN" -H 'Content-Type: application/json' \
-d '{ "name": "carrier-rates", "transport_type": "streamable-http",
"transport_config": { "url": "https://rates.acme.dev/mcp" },
"tags": ["shipping", "http"], "auto_connect": true }'

Ask a question scoped to those tags:

run a tag-scoped query
curl -X POST https://lt.acme.dev/api/insight/mcp-query \
-H "Authorization: Bearer $LT_TOKEN" -H 'Content-Type: application/json' \
-d '{ "prompt": "Cheapest 2-day rate for order ORD-1042", "tags": ["shipping"], "wait": true }'

mcpQuery loads tools from servers matching any of the tags (findServersByTags(tags, 'any')), or every server when no tags are given. Tags are lowercase and hyphenated, stored as a GIN-indexed Postgres array. The router also checks compiled pipelines by full-text search and tag match before falling back to the dynamic loop.

The guarantee

The model sees and calls only the tools the workflow’s principal may call. A tool the model chooses acts as that principal and passes the same manifest gate it carries at /mcp. A workflow with no principal runs its tools as lt-system. See MCP.