Skip to main content
Glama

fetch_spec

Pull a spec by its ID from the active source to retrieve title, body, URL, status, labels, and metadata. Use with parse_spec to extract structured acceptance criteria.

Instructions

Pull a single spec by id from the active source. For markdown_local the id is either the id: field in frontmatter or the filename stem; for github_issues it's the issue number as string. Returns the full Spec record {id, title, body, url, status, labels, metadata}. Pair with parse_spec to extract structured acceptance criteria.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spec_idYes

Implementation Reference

  • The actual tool handler for fetch_spec. Gets spec_id from arguments, calls source.fetch() via the active adapter, and returns the full Spec record as a dict.
    def fetch_spec_tool(arguments: dict) -> dict[str, Any]:
        spec_id = arguments.get("spec_id") or arguments.get("id")
        if not spec_id:
            return {"error": "spec_id is required"}
        source = get_source(SOURCE_NAME)
        spec = source.fetch(str(spec_id))
        return asdict(spec)
  • The dispatch table that maps the string "fetch_spec" to the fetch_spec_tool handler function.
    _DISPATCH: dict[str, Callable[[dict], dict]] = {
        "get_spec_source_info": _meta_info,
        "list_specs": specs_tools.list_specs_tool,
        "fetch_spec": specs_tools.fetch_spec_tool,
        "parse_spec": specs_tools.parse_spec_tool,
        "extract_scenarios": scenarios_tools.extract_scenarios_tool,
        "generate_test_plan": scenarios_tools.generate_test_plan_tool,
        "link_test_to_spec": coverage_tools.link_test_to_spec_tool,
        "get_coverage_matrix": coverage_tools.get_coverage_matrix_tool,
        "get_drift_report": coverage_tools.get_drift_report_tool,
        "analyze_spec_quality": quality_tools.analyze_spec_quality_tool,
        "propose_spec_improvements": quality_tools.propose_spec_improvements_tool,
        "auto_link_tests": auto_link_tools.auto_link_tests_tool,
        "get_optimization_plan": optimization_tools.get_optimization_plan_tool,
        "init_spec_knowledge": spec_knowledge_tools.init_spec_knowledge_tool,
        "get_spec_context": spec_knowledge_tools.get_spec_context_tool,
        "get_spec_history": history_tools.get_spec_history_tool,
        "get_drift_signature": history_tools.get_drift_signature_tool,
        "get_telemetry": telemetry_tools.get_telemetry_tool,
    }
  • The MCP Tool registration for fetch_spec, including its description and inputSchema (requires spec_id string).
    Tool(
        name="fetch_spec",
        description=(
            "Pull a single spec by id from the active source. For markdown_local "
            "the id is either the `id:` field in frontmatter or the filename "
            "stem; for github_issues it's the issue number as string. Returns "
            "the full Spec record {id, title, body, url, status, labels, metadata}. "
            "Pair with parse_spec to extract structured acceptance criteria."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "spec_id": {"type": "string"},
            },
            "required": ["spec_id"],
        },
  • The get_source function used by fetch_spec_tool to obtain the adapter instance for the active source.
    def get_source(name: str) -> SpecSource:
        if name not in REGISTRY:
            raise ValueError(
                f"Unknown SPEC_SOURCE={name!r}. Available: {sorted(REGISTRY)}"
            )
        return REGISTRY[name]()
Behavior4/5

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

The description explains the expected behavior (read operation with no side effects) and clarifies the ID interpretation per source type. However, it lacks details on error handling, permissions, or potential issues like missing IDs.

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 concise, with each sentence adding important information: purpose, ID clarification, return structure, and a practical pairing suggestion. No unnecessary 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?

Given the simple tool with one parameter and no output schema, the description covers the return fields explicitly. It is complete for a basic fetch, though it omits error handling and edge cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides no description for spec_id, but the description compensates fully by explaining its meaning in different contexts (markdown_local vs github_issues), adding significant value beyond the raw schema.

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 that the tool pulls a single spec by ID from the active source, specifies the ID format for markdown_local and github_issues, and distinguishes itself from siblings like list_specs by focusing on individual retrieval.

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 some usage guidance by suggesting pairing with parse_spec, but it does not explicitly state when to use this tool versus alternatives like list_specs or search tools, nor does it mention any prerequisites or exclusions.

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/kao273183/mk-spec-master'

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