Skip to main content
Glama
ziamalik

Bay Street MCP

by ziamalik

compliance_lookup

Search Canadian financial-services regulations and return relevant passages with citation metadata. Designed for compliance, risk, and AI governance queries.

Instructions

Search Canadian financial-services regulations (OSFI, PIPEDA, FINTRAC, Quebec Law 25) and return the most relevant passages with citation metadata. Use this tool whenever the user asks about Canadian financial regulation, compliance, AI/data governance for Canadian financial institutions, AML/ATF, operational risk, model risk, or related topics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural-language question about Canadian financial-services compliance.
top_kNoNumber of passages to return. Default 5, max 10.

Implementation Reference

  • The call_tool function handles the 'compliance_lookup' tool invocation. It validates the tool name, extracts query and top_k arguments, calls _store.search(), and returns results as JSON text content.
    @server.call_tool()
    async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]:
        if name != "compliance_lookup":
            raise ValueError(f"Unknown tool: {name}")
        if _store is None:
            raise RuntimeError("Compliance store not initialized")
    
        query = arguments["query"]
        top_k = min(int(arguments.get("top_k", 5)), 10)
    
        results = _store.search(query, top_k=top_k)
        if not results:
            return [
                TextContent(
                    type="text",
                    text="No relevant passages found. The store may be empty; run `bay-street-ingest` to load a regulation.",
                )
            ]
    
        return [TextContent(type="text", text=json.dumps(results, indent=2))]
  • The list_tools function registers the 'compliance_lookup' tool with its name, description, and input schema (query string + optional top_k integer).
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        return [
            Tool(
                name="compliance_lookup",
                description=(
                    "Search Canadian financial-services regulations (OSFI, PIPEDA, "
                    "FINTRAC, Quebec Law 25) and return the most relevant passages "
                    "with citation metadata. Use this tool whenever the user asks "
                    "about Canadian financial regulation, compliance, AI/data "
                    "governance for Canadian financial institutions, AML/ATF, "
                    "operational risk, model risk, or related topics."
                ),
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "Natural-language question about Canadian financial-services compliance.",
                        },
                        "top_k": {
                            "type": "integer",
                            "description": "Number of passages to return. Default 5, max 10.",
                            "default": 5,
                            "minimum": 1,
                            "maximum": 10,
                        },
                    },
                    "required": ["query"],
                },
            )
        ]
  • The Tool definition includes the input schema for compliance_lookup: required 'query' (string) and optional 'top_k' (integer, default 5, min 1, max 10).
    Tool(
        name="compliance_lookup",
        description=(
            "Search Canadian financial-services regulations (OSFI, PIPEDA, "
            "FINTRAC, Quebec Law 25) and return the most relevant passages "
            "with citation metadata. Use this tool whenever the user asks "
            "about Canadian financial regulation, compliance, AI/data "
            "governance for Canadian financial institutions, AML/ATF, "
            "operational risk, model risk, or related topics."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "Natural-language question about Canadian financial-services compliance.",
                },
                "top_k": {
                    "type": "integer",
                    "description": "Number of passages to return. Default 5, max 10.",
                    "default": 5,
                    "minimum": 1,
                    "maximum": 10,
                },
            },
            "required": ["query"],
        },
    )
  • The ComplianceStore.search() method performs the actual vector similarity search using ChromaDB, returning passages with citation metadata and distance scores.
    def search(self, query: str, top_k: int = 5) -> list[dict[str, Any]]:
        result = self.collection.query(
            query_texts=[query],
            n_results=top_k,
            include=["documents", "metadatas", "distances"],
        )
        documents = result["documents"][0] if result["documents"] else []
        metadatas = result["metadatas"][0] if result["metadatas"] else []
        distances = result["distances"][0] if result["distances"] else []
        return [
            {
                "passage": doc,
                "citation": meta,
                "distance": dist,
            }
            for doc, meta, dist in zip(documents, metadatas, distances, strict=False)
        ]
  • The ComplianceStore class manages a ChromaDB persistent client/collection, with load_default(), count(), and add() methods supporting the compliance_lookup tool.
    class ComplianceStore:
        def __init__(self, db_path: Path = DEFAULT_DB_PATH) -> None:
            db_path.mkdir(parents=True, exist_ok=True)
            self.client = chromadb.PersistentClient(
                path=str(db_path),
                settings=Settings(anonymized_telemetry=False),
            )
            self.collection = self.client.get_or_create_collection(
                name=COLLECTION_NAME,
                metadata={"hnsw:space": "cosine"},
            )
    
        @classmethod
        def load_default(cls) -> ComplianceStore:
            return cls()
    
        def count(self) -> int:
            return self.collection.count()
    
        def add(
            self,
            documents: list[str],
            ids: list[str],
            metadatas: list[dict[str, Any]],
        ) -> None:
            self.collection.add(documents=documents, ids=ids, metadatas=metadatas)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It implies a read-only operation by stating 'search and return', but does not explicitly confirm non-destructive behavior or disclose any side effects, rate limits, or auth requirements. It adds some value by mentioning citation metadata but lacks full transparency.

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 two sentences long, each adding value. The first sentence states functionality, the second provides usage guidance. No unnecessary words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description briefly mentions returning 'most relevant passages with citation metadata', but does not detail the output structure (e.g., fields, format, pagination). For a search tool, more specificity on the return value would improve completeness.

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% with both 'query' and 'top_k' having descriptions. The description does not add any additional meaning beyond what the schema already provides, so the baseline score of 3 is appropriate.

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 tool searches Canadian financial-services regulations, listing specific sources (OSFI, PIPEDA, FINTRAC, Quebec Law 25), and returns relevant passages with citation metadata. The verb 'search' and resource 'Canadian financial-services regulations' are specific, and there are no sibling tools to distinguish from.

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?

The description explicitly says 'Use this tool whenever the user asks about Canadian financial regulation, compliance, AI/data governance for Canadian financial institutions, AML/ATF, operational risk, model risk, or related topics.' This provides clear guidance on when to use, even though no alternatives exist.

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/ziamalik/bay-street-mcp'

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