Skip to main content
Glama
DriftOS

DriftOS MCP Server

Official
by DriftOS

Extract Facts from Branch

driftos_extract_facts
Idempotent

Extract structured facts from conversation branches to identify key information and maintain topic context in semantic routing systems.

Instructions

Trigger fact extraction for a branch. Use when you want to explicitly extract facts from the current conversation state.

Args:

  • branch_id (string): The branch ID to extract facts from

Returns: { "facts": [{ "key": string, "value": string }] }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branch_idYesBranch ID to extract facts from

Implementation Reference

  • Handler function for the 'driftos_extract_facts' tool. It calls driftClient.extractFacts(branch_id), stringifies the result as JSON, and handles errors by returning an error message.
    async (params) => {
      try {
        const result = await driftClient.extractFacts(params.branch_id);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : 'Unknown error';
        return {
          content: [
            {
              type: 'text' as const,
              text: `Error extracting facts: ${message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema validation using Zod for the branch_id parameter.
    inputSchema: z.object({
      branch_id: z.string().min(1).describe('Branch ID to extract facts from'),
    }).strict(),
  • Registration of the 'driftos_extract_facts' tool using server.registerTool, including schema, annotations, description, and inline handler.
      server.registerTool(
        'driftos_extract_facts',
        {
          title: 'Extract Facts from Branch',
          description: `Trigger fact extraction for a branch. Use when you want to explicitly extract facts from the current conversation state.
    
    Args:
      - branch_id (string): The branch ID to extract facts from
    
    Returns:
      { "facts": [{ "key": string, "value": string }] }`,
          inputSchema: z.object({
            branch_id: z.string().min(1).describe('Branch ID to extract facts from'),
          }).strict(),
          annotations: {
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
          },
        },
        async (params) => {
          try {
            const result = await driftClient.extractFacts(params.branch_id);
    
            return {
              content: [
                {
                  type: 'text' as const,
                  text: JSON.stringify(result, null, 2),
                },
              ],
            };
          } catch (error) {
            const message = error instanceof Error ? error.message : 'Unknown error';
            return {
              content: [
                {
                  type: 'text' as const,
                  text: `Error extracting facts: ${message}`,
                },
              ],
              isError: true,
            };
          }
        }
      );
  • src/index.ts:20-20 (registration)
    Invocation of registerFactsTools(server) which registers the 'driftos_extract_facts' tool among others.
    registerFactsTools(server);
Behavior3/5

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

The description adds some behavioral context beyond annotations: it implies this is an explicit trigger for extraction, suggesting it might be state-changing or processing-intensive. However, annotations already cover key traits (readOnlyHint=false, idempotentHint=true, destructiveHint=false), so the bar is lower. The description doesn't add details like rate limits, auth needs, or what 'trigger' entails operationally, leaving room for improvement.

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 appropriately sized and front-loaded: the first sentence states the purpose and usage, followed by structured Args and Returns sections. Every sentence earns its place, but the Returns section could be integrated more seamlessly. It's efficient but not perfectly polished.

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

Completeness4/5

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

Given the tool's moderate complexity (1 parameter, no output schema, annotations provided), the description is fairly complete. It covers purpose, usage, parameters, and return structure. However, it lacks details on what 'facts' entail (e.g., types, format) and doesn't explain the extraction process or potential side effects, which could be useful for an agent.

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 parameter 'branch_id' fully documented in the schema as 'Branch ID to extract facts from'. The description repeats this in the Args section but adds no additional meaning (e.g., format examples, sourcing instructions, or constraints). With high schema coverage, the baseline is 3, and the description doesn't exceed this by providing extra semantic value.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Trigger fact extraction for a branch.' It specifies the verb ('extract facts') and resource ('branch'), distinguishing it from siblings like driftos_get_facts (which likely retrieves existing facts) and driftos_get_context (which gets broader context). However, it doesn't explicitly contrast with all siblings, such as driftos_build_prompt or driftos_route_message.

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?

The description provides clear usage context: 'Use when you want to explicitly extract facts from the current conversation state.' This gives a specific scenario for when to invoke the tool. However, it doesn't explicitly state when not to use it or name alternatives (e.g., driftos_get_facts for retrieving already-extracted facts), which would be needed for a score of 5.

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/DriftOS/driftos-mcp-server'

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