Documentation
¶
Overview ¶
Package tools holds MCP tool registrations. Each resource type lives in its own file (deals.go, persons.go, ...) and exposes a Register function that the server's startup wires up.
Every tool is added to *both* the SDK (via mcp.AddTool) and the registry below. The registry powers the `pipedrive-mcp --dump-schemas` flag, which produces the deterministic JSON the schema-diff CI gate compares against the previous release tag.
The MCP Go SDK does not expose a public Server.Tools() to walk registered tools, so this parallel registry is the workaround. If a future SDK version ships ListTools(), drop this and switch.
Index ¶
- Constants
- Variables
- func Add(t *mcp.Tool)
- func AddTool[In, Out any](s *mcp.Server, t *mcp.Tool, h mcp.ToolHandlerFor[In, Out])
- func DumpJSON(w io.Writer, binaryVersion string) error
- func RegisterActivities(s *mcp.Server, c activitiesClient, companyDomain string, opts RegisterOptions)
- func RegisterCache(s *mcp.Server, c cacheClient)
- func RegisterDeals(s *mcp.Server, c dealsClient, companyDomain string, opts RegisterOptions)
- func RegisterNotes(s *mcp.Server, c notesClient, opts RegisterOptions)
- func RegisterOrganizations(s *mcp.Server, c organizationsClient, companyDomain string, ...)
- func RegisterPersons(s *mcp.Server, c personsClient, companyDomain string, opts RegisterOptions)
- func RegisterPipelines(s *mcp.Server, c pipelinesClient, companyDomain string)
- func RegisterSearch(s *mcp.Server, c searchClient)
- type RegisterOptions
- type Registry
Constants ¶
const SDKVersion = "v1.5.0"
SDKVersion is recorded in the schema dump header so a diff caused by an SDK upgrade can be classified as PATCH rather than as a breaking surface change. Update in lockstep with the go.mod pin.
Variables ¶
var Default = New()
Default is the process-wide registry. Phase 1+ tool packages call Default.Add after mcp.AddTool.
Functions ¶
func AddTool ¶
AddTool registers a tool with the MCP server AND records it in the process-wide Default registry. Schemas are inferred and assigned before mcp.AddTool runs so --dump-schemas (and the schema-diff CI gate) see the same shapes the live server validates against — the SDK copies *t internally and mutates the copy, so a bare *t in our registry would otherwise expose empty schemas.
func RegisterActivities ¶
func RegisterActivities(s *mcp.Server, c activitiesClient, companyDomain string, opts RegisterOptions)
RegisterActivities wires get_activity, list_activities, and create_activity into the MCP server. opts.DryRun, when true, makes create_activity return a synthetic preview without firing the upstream POST.
func RegisterCache ¶
RegisterCache wires the refresh_field_cache tool into the MCP server. The tool has no inputs — it always refreshes all three per-resource caches (deals, persons, organizations) in parallel. Activities don't have a custom-field cache on Pipedrive v2 so they are intentionally absent.
func RegisterDeals ¶
func RegisterDeals(s *mcp.Server, c dealsClient, companyDomain string, opts RegisterOptions)
RegisterDeals wires get_deal, list_deals, and create_deal into the MCP server. opts.DryRun, when true, makes create_deal return a synthetic preview without firing the upstream POST.
func RegisterNotes ¶
func RegisterNotes(s *mcp.Server, c notesClient, opts RegisterOptions)
RegisterNotes wires the notes tools into the MCP server.
Reads (get_note, list_notes) and the create write tool always register. delete_note is destructive and registers ONLY when opts.EnableDestructive is true (per CLAUDE.md hard rule #3 — server-build-time gating, not annotation-based).
opts.DryRun, when true, makes create_note and delete_note return synthetic previews without firing the upstream POST/DELETE.
func RegisterOrganizations ¶
func RegisterOrganizations(s *mcp.Server, c organizationsClient, companyDomain string, opts RegisterOptions)
RegisterOrganizations wires get_organization, list_organizations, and create_organization into the MCP server. opts.DryRun, when true, makes create_organization return a synthetic preview without firing the upstream POST.
func RegisterPersons ¶
func RegisterPersons(s *mcp.Server, c personsClient, companyDomain string, opts RegisterOptions)
RegisterPersons wires get_person, list_persons, and create_person into the MCP server. opts.DryRun, when true, makes create_person return a synthetic preview without firing the upstream POST.
func RegisterPipelines ¶
RegisterPipelines wires list_pipelines and list_stages into the MCP server. The companyDomain is needed for URL injection on outputs; pass cfg.CompanyDomain from the server constructor.
func RegisterSearch ¶
RegisterSearch wires the search tool into the MCP server.
Types ¶
type RegisterOptions ¶ added in v0.2.0
type RegisterOptions struct {
DryRun bool // mirrors PIPEDRIVE_DRY_RUN
EnableDestructive bool // mirrors PIPEDRIVE_ENABLE_DESTRUCTIVE
}
RegisterOptions bundles the server-wide flags every Register function for a write-bearing resource takes. Bundling stops a future caller from swapping `DryRun` and `EnableDestructive` positionally — both type-check, both look fine in code review.
Both fields gate *registration*: when EnableDestructive is false, destructive tools (currently only `delete_note`) don't register at all. Per CLAUDE.md hard rule #3, that's server-build-time gating, not annotation-based — flipping it requires a server restart.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks every tool added via Register/Add for the schema dump. Tests construct a fresh Registry; the process-wide registration uses Default.