Skip to main content
Glama
clinicaltrialsgov-mcp-server

clinicaltrialsgov-mcp-server

by cyanheads

Clinicaltrials Get Field Definitions

clinicaltrials_get_field_definitions
Read-onlyIdempotent

Resolve valid ClinicalTrials.gov field names and paths before using search or filter tools. Find canonical PascalCase identifiers by keyword, drill into a section, or list top-level sections.

Instructions

Resolve valid field names from the ClinicalTrials.gov data model — the canonical PascalCase identifiers (OverallStatus, EnrollmentCount, LeadSponsorName) the other tools take. Every record piece works in clinicaltrials_search_studies fields; a leaf piece (sourceType other than STRUCT) also works in AREA[…] expressions in advancedFilter and the query parameters, and as input to clinicaltrials_get_field_values (LocationGeoPoint aside); a leaf of a date or integer type (NormalizedDate, PartialDate, DateTimeMinutes, integer, long, short) also works in sort. An index-only piece (drill with includeIndexedOnly, e.g. NumLocations) works wherever a leaf does except fields. Select a mode: "search" — keyword search returning ranked matches (pass query, e.g. "enrollment", "sponsor", "adverse events"); "drill" — drill into a specific section by dot-notation path (pass path, e.g. "protocolSection.designModule"); "overview" — top-level summary of all sections (no additional args).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mode": "<mode>"
    },
    "name": "clinicaltrials_get_field_definitions"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeYesOperation mode. "search" — keyword search (requires `query`); "drill" — drill into a section by path (requires `path`); "overview" — list all top-level sections (no other args needed).
pathNodrill mode only. Dot-notation path to drill into — e.g., "protocolSection.designModule", "protocolSection.eligibilityModule", "resultsSection". Returns the section's individual fields.
limitNosearch mode only. Maximum results to return. Default: 20. A value at or past the match count returns every match.
queryNosearch mode only. Keyword to search field names by — e.g., "enrollment", "sponsor", "adverse events". Returns matching field names ranked by relevance with their full paths and data types.
includeIndexedOnlyNodrill mode only. Also list index-only pieces (search-index fields such as StudyFirstPostYear, NumLocations) alongside the record fields. They work in `AREA[…]`, in `sort` (the integer counts), and in clinicaltrials_get_field_values, but not in clinicaltrials_search_studies `fields`; search mode never lists them. Default: false.

Output Schema

NameRequiredDescriptionDefault
capNoThe limit cap applied to this search (search mode only).
errorNoPresent when the call failed. Absent on success.
shownNoNumber of fields returned (search mode only).
fieldsNoField definitions, ordered by relevance when mode is "search".
noticeNoRecovery guidance when search mode returns no matches, or a truncation note when results are capped.
truncatedNoTrue when the field list was capped by the limit parameter (search mode only).
searchQueryNoEcho of the keyword used in search mode. Absent for drill and overview.
totalFieldsNoTotal fields returned.
resolvedPathNoResolved path when mode is "drill".
totalMatchesNoTotal fields matching the query before the limit cap was applied (search mode only). Compare against `shown` to size a follow-up limit, or to see that a capped result set is barely over the cap rather than hundreds deep.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.11.3
    • changedInput schema / properties / includeIndexedOnly / description
      Previous value: -"drill mode only. Also list index-only pieces (search-index fields such as StudyFirstPostYear) alongside the record fields. Default: false."New value: +"drill mode only. Also list index-only pieces (search-index fields such as StudyFirstPostYear, NumLocations) alongside the record fields. They work in `AREA[…]`, in `sort` (the integer counts), and in clinicaltrials_get_field_values, but not in clinicaltrials_search_studies `fields`; search mode never lists them. Default: false."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `blank_value`: The selected mode's required argument was supplied with a whitespace-only value. `mode_mismatch`: An argument belonging to a different mode was supplied alongside the selected mode. `mode_requires`: The selected mode's required argument was omitted. `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov answered HTTP 429 on every attempt, or the call’s time budget ran out after a 429. `retry_deadline_exceeded`: ClinicalTrials.gov did not answer within the call’s time budget, which covers every request, retry, and wait the call makes. `upstream_timeout`: ClinicalTrials.gov answered HTTP 504 (gateway timeout) on every attempt. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `blank_value`: The selected mode's required argument was supplied with a whitespace-only value. `mode_mismatch`: An argument belonging to a different mode was supplied alongside the selected mode. `mode_requires`: The selected mode's required argument was omitted. `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov answered HTTP 429 on every attempt, or the call’s time budget ran out after a 429. `retry_deadline_exceeded`: ClinicalTrials.gov did not answer within the call’s time budget, which covers every request, retry, and wait the call makes. `upstream_timeout`: ClinicalTrials.gov answered HTTP 504 (gateway timeout) or 408 (request timeout), or sent no answer within the per-attempt timeout, on every attempt. `upstream_unavailable`: Every attempt failed on ClinicalTrials.gov’s side — HTTP 500, 502, or 503, a dropped connection or one the network gave up opening, or a 200 body that is not the JSON the route serves (an HTML page, unparseable text, the wrong shape, or, in search mode, a field tree that holds no fields) — or it answered with another 5xx, such as 505, or the connection was refused or its host name did not resolve, none of which is retried. `upstream_rejected`: ClinicalTrials.gov refused the request with a status its API does not use for a bad query — HTTP 501, a 3xx, or a 4xx such as 401, 403, or 410 — or answered with an HTML error page in place of its own 404. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "blank_value",
      -  "mode_mismatch",
      -  "mode_requires",
      -  "path_not_found",
      -  "rate_limited",
      -  "retry_deadline_exceeded",
      -  "upstream_timeout"
      -]New value: +[
      +  "blank_value",
      +  "mode_mismatch",
      +  "mode_requires",
      +  "path_not_found",
      +  "rate_limited",
      +  "retry_deadline_exceeded",
      +  "upstream_timeout",
      +  "upstream_unavailable",
      +  "upstream_rejected"
      +]
    • changedOutput schema / properties / fields / items / properties / piece / description
      Previous value: -"PascalCase identifier. Any piece goes to search `fields`; a leaf (sourceType other than STRUCT) also to `AREA[]` and clinicaltrials_get_field_values; a date or integer leaf also to `sort`."New value: +"PascalCase identifier. Any record piece goes to search `fields`, an index-only piece never; a leaf (sourceType other than STRUCT) also to `AREA[]` and clinicaltrials_get_field_values; a date or integer leaf also to `sort`."
  2. Changed3 schema fields changedv2.11.2
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `blank_value`: The selected mode's required argument was supplied with a whitespace-only value. `mode_mismatch`: An argument belonging to a different mode was supplied alongside the selected mode. `mode_requires`: The selected mode's required argument was omitted. `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov returned 429 after retry budget exhausted. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `blank_value`: The selected mode's required argument was supplied with a whitespace-only value. `mode_mismatch`: An argument belonging to a different mode was supplied alongside the selected mode. `mode_requires`: The selected mode's required argument was omitted. `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov answered HTTP 429 on every attempt, or the call’s time budget ran out after a 429. `retry_deadline_exceeded`: ClinicalTrials.gov did not answer within the call’s time budget, which covers every request, retry, and wait the call makes. `upstream_timeout`: ClinicalTrials.gov answered HTTP 504 (gateway timeout) on every attempt. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "blank_value",
      -  "mode_mismatch",
      -  "mode_requires",
      -  "path_not_found",
      -  "rate_limited"
      -]New value: +[
      +  "blank_value",
      +  "mode_mismatch",
      +  "mode_requires",
      +  "path_not_found",
      +  "rate_limited",
      +  "retry_deadline_exceeded",
      +  "upstream_timeout"
      +]
    • changedOutput schema / properties / fields / items / properties / piece / description
      Previous value: -"PascalCase identifier for use in `fields`/`AREA[]`/`sort` params."New value: +"PascalCase identifier. Any piece goes to search `fields`; a leaf (sourceType other than STRUCT) also to `AREA[]` and clinicaltrials_get_field_values; a date or integer leaf also to `sort`."
  3. Changed1 schema field changedv2.11.0
    • changedInput schema / properties / includeIndexedOnly / description
      Previous value: -"drill mode only. Only return indexed (searchable) fields. Default: false."New value: +"drill mode only. Also list index-only pieces (search-index fields such as StudyFirstPostYear) alongside the record fields. Default: false."
  4. Changed2 schema fields changedv2.10.1
    • changedInput schema / properties / limit / description
      Previous value: -"search mode only. Maximum results to return. Default: 20."New value: +"search mode only. Maximum results to return. Default: 20. A value at or past the match count returns every match."
    • changedInput schema / properties / limit / maximum
      Previous value: -100New value: +9007199254740991
  5. Changed2 schema fields changedv2.9.6
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov returned 429 after retry budget exhausted. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `blank_value`: The selected mode's required argument was supplied with a whitespace-only value. `mode_mismatch`: An argument belonging to a different mode was supplied alongside the selected mode. `mode_requires`: The selected mode's required argument was omitted. `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov returned 429 after retry budget exhausted. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "path_not_found",
      -  "rate_limited"
      -]New value: +[
      +  "blank_value",
      +  "mode_mismatch",
      +  "mode_requires",
      +  "path_not_found",
      +  "rate_limited"
      +]
  6. Changed6 schema fields changedv2.9.2
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "fields",
      +      "totalFields"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `path_not_found`: The dot-notation path does not match any node in the field tree. `rate_limited`: ClinicalTrials.gov returned 429 after retry budget exhausted. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "path_not_found",
      +            "rate_limited"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "fields",
      -  "totalFields"
      -]
  7. Changed1 schema field changedv2.9.1
    • addedOutput schema / properties / totalMatches
      Added value: +{
      +  "description": "Total fields matching the query before the limit cap was applied (search mode only). Compare against `shown` to size a follow-up limit, or to see that a capped result set is barely over the cap rather than hundreds deep.",
      +  "type": "number"
      +}
  8. Changed4 schema fields changedv2.7.0
    • addedOutput schema / properties / cap
      Added value: +{
      +  "description": "The limit cap applied to this search (search mode only).",
      +  "type": "number"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery guidance when search mode returns no matches — suggests alternative keywords."New value: +"Recovery guidance when search mode returns no matches, or a truncation note when results are capped."
    • addedOutput schema / properties / shown
      Added value: +{
      +  "description": "Number of fields returned (search mode only).",
      +  "type": "number"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "True when the field list was capped by the limit parameter (search mode only).",
      +  "type": "boolean"
      +}
  9. Changed2 schema fields changedv2.5.4
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Recovery guidance when search mode returns no matches — suggests alternative keywords.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / searchQuery / description
      Previous value: -"Echo of the keyword when mode is \"search\"."New value: +"Echo of the keyword used in search mode. Absent for drill and overview."
  10. Addedv2.5.1
  11. Removedv2.4.12
  12. Addedv2.0.6

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly/openWorld/idempotent, and the description goes well beyond them by disclosing the field taxonomy — record pieces vs leaves vs index-only pieces — and precisely where each class of name is rejected (e.g. index-only names like NumLocations fail in `fields`). The remaining gap is that it doesn't say what an unmatched search query returns or how ranked matches are ordered in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded, which is good, but the middle sentence is a single ~90-word run-on chaining capabilities, exclusions, and type lists. Each clause carries real routing information, so nothing is strictly wasted — but its density makes it harder to scan than a short bulleted structure would be.

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?

For a five-parameter discovery tool with an output schema (so return shapes needn't be described), everything an agent needs is present: what the tool returns conceptually, which modes exist, and precisely which downstream surfaces each returned name is valid in. No significant omission remains.

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 coverage is 100% and the description's mode explanation largely mirrors the `mode` enum description already in the schema, so the marginal value is modest. It does add cross-parameter context by naming example `query`/`path` values and by tying includeIndexedOnly semantics to the drill mode, but nothing reinterprets a parameter the schema leaves ambiguous.

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?

Opens with a specific verb and resource: 'Resolve valid field names from the ClinicalTrials.gov data model', and immediately pins down what a field name is (canonical PascalCase identifiers like OverallStatus, EnrollmentCount). It also distinguishes this lookup tool from the data tools that consume its output by naming them explicitly.

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?

Gives explicit routing rules: which field classes work in `fields`, in `AREA[…]`, in `advancedFilter`, in clinicaltrials_get_field_values (with the LocationGeoPoint exclusion), and in `sort`. It then prescribes when to pick each mode (search vs drill vs overview) with concrete example inputs, so an agent can choose without inference.

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