Skip to main content
Glama

twining_add_relation

Create connections between knowledge graph entities by specifying source, target, and relation type to build structured relationships for development task coordination.

Instructions

Add a relation between two knowledge graph entities. Source and target can be entity IDs or names. Returns an error for ambiguous name matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesSource entity ID or name
targetYesTarget entity ID or name
typeYesRelation type: "depends_on", "implements", "decided_by", "affects", "tested_by", "calls", "imports", "related_to"
propertiesNoKey-value properties for this relation (max 50 entries, values ≤1000 chars)

Implementation Reference

  • MCP tool registration for twining_add_relation which calls the graph engine's addRelation method.
    // twining_add_relation — Add a relation between two entities
    server.registerTool(
      "twining_add_relation",
      {
        description:
          "Add a relation between two knowledge graph entities. Source and target can be entity IDs or names. Returns an error for ambiguous name matches.",
        inputSchema: {
          source: z
            .string()
            .describe("Source entity ID or name"),
          target: z
            .string()
            .describe("Target entity ID or name"),
          type: z
            .string()
            .describe(
              'Relation type: "depends_on", "implements", "decided_by", "affects", "tested_by", "calls", "imports", "related_to"',
            ),
          properties: z
            .record(z.string().max(1000))
            .optional()
            .refine(
              (obj) => obj === undefined || Object.keys(obj).length <= 50,
              { message: "Maximum 50 properties per relation" },
            )
            .describe("Key-value properties for this relation (max 50 entries, values ≤1000 chars)"),
        },
      },
      async (args) => {
        try {
          const relation = await engine.addRelation({
            source: args.source,
            target: args.target,
            type: args.type as Parameters<typeof engine.addRelation>[0]["type"],
            properties: args.properties,
          });
          return toolResult({ id: relation.id });
        } catch (e) {
          if (e instanceof TwiningError) {
            return toolError(e.message, e.code);
          }
          return toolError(
            e instanceof Error ? e.message : "Unknown error",
            "INTERNAL_ERROR",
          );
        }
      },
    );
  • GraphEngine implementation of addRelation, which delegates to the graph store.
    /** Delegate relation creation to store. */
    async addRelation(input: {
      source: string;
      target: string;
      type: Relation["type"];
      properties?: Record<string, string>;
    }): Promise<Relation> {
      return this.graphStore.addRelation(input);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses one behavioral trait: 'Returns an error for ambiguous name matches.' However, it does not cover critical aspects like whether this is a mutation (implied by 'Add'), permission requirements, rate limits, idempotency, or what happens on success. For a mutation tool with zero annotation coverage, this is insufficient.

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 that front-loads the core purpose and includes a key behavioral note. Every word earns its place with zero waste, making it easy to parse quickly.

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 this is a mutation tool (adding relations) with no annotations and no output schema, the description is incomplete. It lacks information on success behavior, error handling beyond ambiguous names, permissions, or return values. For a tool with 4 parameters and nested objects, more context is needed to guide effective use.

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%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't clarify semantics of 'source' vs 'target' or explain relation types further). Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Add a relation') and resource ('between two knowledge graph entities'), distinguishing it from siblings like twining_add_entity (adds entities) or twining_graph_query (queries relations). It specifies the verb, resource, and scope precisely.

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

Usage Guidelines2/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. While it mentions an error for ambiguous name matches, it does not explain prerequisites, when to use it over other relation-related tools (if any), or typical use cases. The description lacks explicit when/when-not instructions or named 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/daveangulo/twining-mcp'

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