Skip to main content
Glama

polarity_ask

Answers natural-language questions by synthesizing relevant nodes and edges from your personal knowledge graph, providing cited sources for context-aware reasoning.

Instructions

Ask a natural-language question over the user's personal knowledge graph. Cosmos synthesizes an answer from relevant nodes and edges. Use this when the user wants context-aware reasoning rather than raw data. Returns answer text plus cited node/edge ids.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • Tool definition for 'polarity_ask' in the TOOLS array. Includes name, description, inputSchema (zod validation for 'query' string), and handler.
    {
      name: "polarity_ask",
      description:
        "Ask a natural-language question over the user's personal knowledge graph. Cosmos synthesizes an answer from relevant nodes and edges. Use this when the user wants context-aware reasoning rather than raw data. Returns answer text plus cited node/edge ids.",
      inputSchema: z
        .object({
          query: z.string().min(1).max(2000),
        })
        .strict(),
      handler: async (input, client) => {
        const { query } = input as { query: string };
        return client.ask(query);
      },
    },
  • The actual handler method in CosmosClient that makes an HTTP POST to /api/polarity/ask with the polarity_user_id and query string.
    ask(query: string) {
      return this.request<AskResponse>({
        method: "POST",
        path: "/api/polarity/ask",
        body: { polarity_user_id: this.config.polarityUserId, query },
      });
    }
  • Response type for the ask endpoint, containing answer text and optional cited node/edge IDs.
    export interface AskResponse {
      answer: string;
      cited_node_ids?: number[];
      cited_edge_ids?: number[];
    }
  • Input schema validation for polarity_ask: requires a 'query' string between 1 and 2000 characters.
    inputSchema: z
      .object({
        query: z.string().min(1).max(2000),
      })
      .strict(),
  • src/server.ts:44-46 (registration)
    MCP CallTool handler that looks up the tool by name, validates input via Zod schema, and invokes the handler.
    }));
    
    server.setRequestHandler(CallToolRequestSchema, async (req) => {
Behavior4/5

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

No annotations provided, so description carries full burden. It describes the tool as returning answer text plus cited node/edge ids, implying read-only behavior. Could explicitly state no side effects, but it's well understood.

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?

Two concise sentences, front-loaded with purpose, then usage guidance and return value. No wasted words.

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?

Given no output schema, description mentions return value (answer text plus cited ids). Single parameter is well explained. Fully adequate for this simple tool.

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 has 0% coverage, so description must compensate. It adds that 'query' is a natural-language question, though it lacks examples or additional format details.

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 clearly states the tool asks a natural-language question over the personal knowledge graph and synthesizes an answer, distinguishing it from sibling tools like polarity_dump which return raw data.

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

Usage Guidelines5/5

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

Explicitly says 'Use this when the user wants context-aware reasoning rather than raw data,' providing clear guidance on when to use this tool versus alternatives.

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

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/teampolarity/cosmos-mcp'

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