Skip to main content
Glama

execute-prepared-query

Run predefined queries on the Consul MCP Server to retrieve specific data or configurations using a query ID. Streamlines access to Consul services, health checks, KV stores, and more.

Instructions

Execute a prepared query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoID of the prepared query

Implementation Reference

  • The core handler function for the 'execute-prepared-query' tool. It takes the prepared query ID, executes it via consul.query.execute(id), stringifies the results, and returns them in the MCP content format. Includes error handling.
    async ({ id }) => {
      try {
        // @ts-ignore - The Consul type definitions are incomplete
        const results = await consul.query.execute(id);
        return { content: [{ type: "text", text: `Query results:\n\n${JSON.stringify(results, null, 2)}` }] };
      } catch (error) {
        console.error("Error executing prepared query:", error);
        return { content: [{ type: "text", text: `Error executing prepared query: ${id}` }] };
      }
    }
  • Zod input schema defining the 'id' parameter as a required string for the prepared query ID.
    {
      id: z.string().default("").describe("ID of the prepared query"),
    },
  • Registration of the 'execute-prepared-query' tool on the MCP server within the registerPreparedQueryTools function, including name, description, input schema, and inline handler.
    server.tool(
      "execute-prepared-query",
      "Execute a prepared query",
      {
        id: z.string().default("").describe("ID of the prepared query"),
      },
      async ({ id }) => {
        try {
          // @ts-ignore - The Consul type definitions are incomplete
          const results = await consul.query.execute(id);
          return { content: [{ type: "text", text: `Query results:\n\n${JSON.stringify(results, null, 2)}` }] };
        } catch (error) {
          console.error("Error executing prepared query:", error);
          return { content: [{ type: "text", text: `Error executing prepared query: ${id}` }] };
        }
      }
    );
Behavior1/5

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

With no annotations provided, the description carries full burden but fails to disclose behavioral traits. It does not indicate if this is a read/write operation, potential side effects (e.g., data modification), authentication needs, or error handling, making it inadequate for safe and effective use.

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, efficient sentence with no wasted words, making it highly concise and front-loaded. However, this brevity contributes to underspecification rather than clarity.

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

Completeness2/5

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

Given the complexity of executing queries, lack of annotations, and no output schema, the description is incomplete. It omits critical details like return values, error conditions, or dependencies on other tools, failing to provide enough context for reliable agent operation.

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%, with the single parameter 'id' documented as 'ID of the prepared query'. The description adds no additional meaning beyond this, such as format examples or constraints, so it meets the baseline for adequate but unenriched parameter information.

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

Purpose2/5

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

The description 'Execute a prepared query' restates the tool name with minimal elaboration, making it tautological. While it specifies the verb 'execute' and resource 'prepared query', it lacks detail about what execution entails (e.g., running a database query, returning results) and does not differentiate from siblings like 'create-prepared-query' or 'get-kv'.

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives. It does not mention prerequisites (e.g., needing a prepared query ID), exclusions, or related tools like 'create-prepared-query' for setup, leaving the agent with no context for appropriate usage.

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

Related 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/kocierik/consul-mcp-server'

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