Skip to main content
Glama

implementations

Find concrete classes that structurally satisfy a Protocol port through real type checking, even when adapters never subclass it explicitly.

Instructions

Find concrete classes that structurally satisfy a Protocol port.

Many hexagonal codebases define ports as Protocols that adapters never subclass explicitly, so ty's own implementation/typeHierarchy return nothing for them. This scans classes under SOURCE_ROOT (the whole workspace by default; see CODENAV_MCP_SOURCE_ROOT) whose method names cover the protocol's, then verifies each candidate with ty's real type checker via an in-memory probe file (never written to disk) — so a result means "assignable", not just "same method names". port_name must itself resolve to a Protocol class; other classes' subclasses are better found with references/symbol_info. name and query are accepted as aliases for port_name. file_path narrows the port lookup to one file when the name exists in several. Members inherited from same-workspace base classes, and fields/properties declared by the port, count when matching names. Directories listed in CODENAV_MCP_EXTRA_SOURCE_ROOTS (e.g. tests) are scanned too; their matches (test doubles) are listed under a separate heading.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
queryNo
file_pathNo
port_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses that scanning defaults to the whole workspace, is controlled by SOURCE_ROOT / CODENAV_MCP_SOURCE_ROOT and CODENAV_MCP_EXTRA_SOURCE_ROOTS, that verification uses an in-memory probe file never written to disk, and that test-double matches are reported under a separate heading. That is exactly the side-effect and result-interpretation context annotations would otherwise need to supply.

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 key routing sentence is front-loaded and no sentence is filler — env vars, alias handling, and match semantics all earn their place. It is on the dense side at roughly eight sentences, but the length is justified by the zero-coverage schema and absent annotations.

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 four undocumented parameters, no annotations, and a real type-checking workflow, the description covers scope, side effects, aliases, and result interpretation ('assignable', not just same method names). Return-value details are rightly omitted since an output schema exists.

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?

Schema description coverage is 0%, so the description must compensate, and it does: `port_name` must resolve to a Protocol class, `name` and `query` are documented aliases, and `file_path` is explained as narrowing port lookup when the name exists in several files. All four parameters gain meaning beyond the bare schema types.

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 first sentence states a precise verb+resource: finding concrete classes that structurally satisfy a `Protocol` port. It explicitly contrasts itself against ty's own `implementation`/`typeHierarchy` and against `references`/`symbol_info`, so an agent can distinguish it from every relevant sibling.

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?

It gives an explicit when-to-use condition (hexagonal codebases with Protocol ports that adapters never subclass, where `implementation`/`typeHierarchy` return nothing) and names the alternatives for the cases this tool is wrong for (`references`/`symbol_info` for ordinary subclass lookups, and the `file_path` escape hatch for ambiguous names).

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