Skip to main content
Glama

Search Charity Commission Register

charity_search
Read-onlyIdempotent

Search the Charity Commission register of England and Wales by name or keyword. Returns matching charities with registration number, status, and registration date.

Instructions

Search the Charity Commission register of England and Wales by name or keyword.

Returns matching charities with registration number, status, and registration date. Use charity_profile for full details once you have the charity number. The upstream searchCharityName endpoint returns the full list in one shot — pagination is applied client-side via offset/limit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesCharity name or keyword to search for
offsetNoNumber of items to skip before this page. Default 0.
limitNoMax items to return in this page. Default 20; raise to 100 for bulk views.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term applied.
totalYesTotal matches returned by upstream.
offsetYesNumber of items skipped before this page (client-side).
limitYesMax items requested for this page.
returnedYesItems actually returned on this page.
has_moreYesTrue if more items may exist beyond this page. Re-call with offset=offset+returned to continue.
charitiesNoMatching charity records.

Implementation Reference

  • Async handler for the charity_search tool. Calls the Charity Commission API /searchCharityName/{query}, applies client-side pagination (offset/limit), maps raw response items to CharitySearchItem models, and returns a CharitySearchResult with metadata.
    async def charity_search(
        query: Annotated[str, Field(description="Charity name or keyword to search for", min_length=2, max_length=200)],
        offset: Annotated[int, Field(description="Number of items to skip before this page. Default 0.", ge=0, le=10000)] = 0,
        limit: Annotated[int, Field(description="Max items to return in this page. Default 20; raise to 100 for bulk views.", ge=1, le=100)] = 20,
    ) -> CharitySearchResult:
        """Search the Charity Commission register of England and Wales by name or keyword.
    
        Returns matching charities with registration number, status, and
        registration date. Use charity_profile for full details once you
        have the charity number. The upstream `searchCharityName` endpoint
        returns the full list in one shot — pagination is applied
        client-side via offset/limit.
        """
        async with charity_client() as client:
            resp = await _request_with_retry(
                client, "GET",
                f"/searchCharityName/{query}",
            )
            data = resp.json()
    
        # API returns a list of charity objects directly
        all_charities = data if isinstance(data, list) else []
        total = len(all_charities)
    
        page_slice = all_charities[offset : offset + limit]
    
        items: list[CharitySearchItem] = []
        for raw in page_slice:
            raw_status = raw.get("reg_status")
            items.append(
                CharitySearchItem(
                    charity_number=str(raw.get("reg_charity_number")) if raw.get("reg_charity_number") is not None else None,
                    charity_name=raw.get("charity_name"),
                    reg_status=raw_status,
                    reg_status_label=_STATUS_LABELS.get(raw_status or "", raw_status),
                    date_of_registration=(raw.get("date_of_registration") or "")[:10] or None,
                )
            )
    
        has_more = (offset + len(items)) < total
    
        return CharitySearchResult(
            query=query,
            total=total,
            offset=offset,
            limit=limit,
            returned=len(items),
            has_more=has_more,
            charities=items,
        )
  • Pydantic model for a single charity search result item, with fields for charity number, name, status code, status label, and registration date.
    class CharitySearchItem(BaseModel):
        """A single hit in a Charity Commission name search."""
    
        model_config = BASE_CFG
    
        charity_number: str | None = Field(
            None,
            description=(
                "Charity Commission registration number. Pass to charity_profile "
                "for the full record."
            ),
        )
        charity_name: str | None = Field(None, description="Registered charity name.")
        reg_status: str | None = Field(
            None,
            description=(
                "Registration status code as returned upstream: 'R' registered, "
                "'RM' removed."
            ),
        )
        reg_status_label: str | None = Field(
            None,
            description="Human-readable registration status ('Registered', 'Removed').",
        )
        date_of_registration: str | None = Field(
            None, description="Date of first registration (ISO YYYY-MM-DD)."
        )
  • Pydantic model for the paginated charity search result, containing query metadata and a list of CharitySearchItem records.
    class CharitySearchResult(BaseModel):
        """Paginated result of a Charity Commission name search."""
    
        model_config = BASE_CFG
    
        query: str = Field(..., description="Search term applied.")
        total: int = Field(..., description="Total matches returned by upstream.")
        offset: int = Field(
            ..., description="Number of items skipped before this page (client-side)."
        )
        limit: int = Field(..., description="Max items requested for this page.")
        returned: int = Field(..., description="Items actually returned on this page.")
        has_more: bool = Field(
            ...,
            description=(
                "True if more items may exist beyond this page. Re-call with "
                "offset=offset+returned to continue."
            ),
        )
        charities: list[CharitySearchItem] = Field(
            default_factory=list,
            description="Matching charity records.",
        )
  • charity.py:56-65 (registration)
    Registration of the charity_search tool via the @mcp.tool decorator with name and annotations. This is inside the register_tools() function which is called from server.py.
    @mcp.tool(
        name="charity_search",
        annotations={
            "title": "Search Charity Commission Register",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True,
        },
    )
  • Helper dictionary mapping charity registration status codes to human-readable labels, used by the charity_search handler.
    _STATUS_LABELS = {"R": "Registered", "RM": "Removed"}
Behavior4/5

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

Annotations already declare readOnlyHint=true. Description adds that the upstream endpoint returns the full list and pagination is client-side, which is useful behavioral context beyond the annotations.

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?

Three sentences with no filler. Key information is front-loaded: purpose, then usage hint, then behavioral detail. Every sentence earns its place.

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 the presence of an output schema and annotations, the description covers purpose, returned fields, pagination behavior, and sibling tool alternative. No significant gaps.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. Description adds value by explaining that offset/limit implement client-side pagination, helping the agent understand how these parameters affect the query.

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 states 'Search the Charity Commission register of England and Wales by name or keyword' with clear verb, resource, and scope. It also distinguishes from sibling charity_profile by noting its role as an initial search.

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?

Directs users to use charity_profile for full details after obtaining a charity number, providing an explicit alternative. Does not elaborate on when not to use but the guidance is clear enough.

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/paulieb89/uk-due-diligence-mcp'

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