Skip to main content
Glama
Gonzih

mcp-opencorporates

by Gonzih

search_officers

Search for company officers such as directors, shareholders, and agents across jurisdictions by name, with optional jurisdiction filter.

Instructions

Search for officers (directors, shareholders, agents) across all companies in OpenCorporates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesOfficer name or search query
jurisdiction_codeNoJurisdiction code to filter results (e.g. 'us_de', 'gb')
pageNoPage number for pagination (default 1)

Implementation Reference

  • TypeScript interface defining the input arguments for the search_officers tool: search query 'q' (required), optional jurisdiction_code, and optional page number.
    interface SearchOfficersArgs {
      q: string;
      jurisdiction_code?: string;
      page?: number;
    }
  • src/index.ts:132-148 (registration)
    Registration of the 'search_officers' tool in the ListToolsRequestSchema handler, defining its name, description, and JSON Schema input specification.
    {
      name: "search_officers",
      description:
        "Search for officers (directors, shareholders, agents) across all companies in OpenCorporates.",
      inputSchema: {
        type: "object",
        properties: {
          q: { type: "string", description: "Officer name or search query" },
          jurisdiction_code: {
            type: "string",
            description: "Jurisdiction code to filter results (e.g. 'us_de', 'gb')",
          },
          page: { type: "number", description: "Page number for pagination (default 1)" },
        },
        required: ["q"],
      },
    },
  • Handler logic for the 'search_officers' tool: calls the OpenCorporates API /officers/search endpoint, maps results to a clean output format including officer details and associated company info, and returns JSON output.
    case "search_officers": {
      const { q, jurisdiction_code, page } = args as unknown as SearchOfficersArgs;
      if (!q) throw new Error("Parameter 'q' is required");
    
      const data = (await apiFetch("/officers/search", {
        q,
        jurisdiction_code,
        page,
      })) as { results: { officers: Array<{ officer: Record<string, unknown> }> } };
    
      const officers = data.results?.officers ?? [];
      if (officers.length === 0) return textResult("No officers found matching that query.");
    
      const out = officers.map(({ officer: o }) => {
        const company = o["company"] as Record<string, unknown> | null;
        return {
          name: o["name"],
          position: o["position"],
          start_date: o["start_date"],
          end_date: o["end_date"],
          inactive: o["inactive"],
          company: company
            ? {
                name: company["name"],
                company_number: company["company_number"],
                jurisdiction_code: company["jurisdiction_code"],
                opencorporates_url: company["opencorporates_url"],
              }
            : null,
          opencorporates_url: o["opencorporates_url"],
        };
      });
      return textResult(JSON.stringify(out, null, 2));
    }
  • Helper function that constructs URLs for API requests, appending the API key and query parameters as needed. Used by the search_officers handler via apiFetch.
    function buildUrl(
      path: string,
      params: Record<string, string | number | undefined> = {}
    ): string {
      const url = new URL(`${BASE_URL}${path}`);
      if (API_KEY) {
        url.searchParams.set("api_token", API_KEY);
      }
      for (const [key, value] of Object.entries(params)) {
        if (value !== undefined && String(value) !== "") {
          url.searchParams.set(key, String(value));
        }
      }
      return url.toString();
    }
  • Helper function that wraps a string response into the MCP text result format used by all tool handlers including search_officers.
    function textResult(content: string) {
      return {
        content: [{ type: "text" as const, text: content }],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the purpose. It does not disclose behavioral traits such as authentication requirements, rate limits, result format, or error handling. The description is too brief for a search tool.

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 description is a single sentence, very concise and to the point. However, it could be slightly more detailed without losing conciseness, e.g., mentioning the return type. Still, it earns its place without waste.

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 no output schema and no annotations, the description is incomplete. It does not explain what the search returns, how results are structured, or provide usage context beyond the basic purpose. The tool is simple, but more context is needed for 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 coverage is 100%, so the description adds no additional meaning beyond the schema. The baseline of 3 is appropriate as it does not enhance parameter understanding.

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 action 'search', the resource 'officers', and provides specific types (directors, shareholders, agents) and scope 'across all companies'. It distinguishes from siblings like get_company_officers which returns officers for a specific company.

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

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for global officer search, but it does not explicitly state when to use it vs. alternatives like get_company_officers. No when-not-to-use or prerequisite guidance is provided.

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/Gonzih/mcp-opencorporates'

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