Skip to main content
Glama
Flux-Frontiers

SwiftKG MCP Server

type_hierarchy

Fetch a Swift type's complete relationship map in one call: subclasses, conformers, extensions, and parent declarations. Provide the node ID to receive a labeled JSON with all graph connections.

Instructions

Return everything the graph knows about one Swift type's relationships.

Swift spreads a type across three relations that the sibling language modules do not have to separate, and answering "what is this type" means reading all three at once:

  • conformers — every type and extension conforming to it, if it is a protocol. This is the question about a protocol.

  • subclasses — every direct subclass, if it is a class or actor.

  • extensions — every extension declared on it, which in Swift routinely live in other files. "Where is the rest of this type" is a real question with a graph answer.

  • conforms_to / inherits_from — what it declares for itself.

Calling callers() three times with three relations returns the same facts; this returns them together, already labelled, because for a Swift type they are one question.

:param node_id: Node ID of a class, struct, enum, protocol or actor, e.g. proto:Sources/SampleKit/Storage.swift:Repository. :return: JSON with node, conformers, subclasses, extensions, conforms_to and inherits_from.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
node_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

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

Since no annotations are provided, the description carries the burden of behavioral disclosure. It accurately states the tool returns all relationship data without side effects (no mutation). It covers what the tool does and its return structure, but doesn't mention potential edge cases like missing node IDs or error behavior. Still, for a read-only query tool, the description is reasonably transparent.

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 well-structured with a one-sentence summary followed by explicit bullet points for each relationship, and then a practical note about the alternative method. The parameter documentation is included inline, and the whole text is front-loaded with the tool's purpose. No wasted words.

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?

The tool has an output schema (though not detailed here), and the description fully explains the input parameter and the structure of the output, listing all six fields (node, conformers, subclasses, extensions, conforms_to, inherits_from). The only minor gap is not detailing the exact format of node_id beyond an example, but the example is fairly illustrative. Given the complexity of Swift's type system, the description provides nearly complete context.

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?

The input schema provides only the parameter name 'node_id' with no description. The description supplements this by specifying the node types (class, struct, etc.) and giving a concrete example ID format. However, it doesn't explain the exact format beyond the example, and the coverage is high for a single required param. Baseline 3 is appropriate as the description adds value but the schema is minimal.

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?

Description clearly states the tool's purpose: returning all relationship facts for a Swift type. It explicitly enumerates the four relationship categories and explains the Swift-specific motivation for combining them. This differentiates it from siblings like callers and get_node, which would require multiple calls.

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?

The description explicitly contrasts this tool with calling callers() three times, stating that this tool returns the same facts together, 'already labelled'. This gives clear when-to-use guidance and names the alternative approach. It also emphasizes the Swift-specific relevance, implying it's not needed for other languages.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.