API Reference
PitchLense MCP - Professional Startup Risk Analysis Package
A comprehensive Model Context Protocol (MCP) package for analyzing startup investment risks using AI-powered assessment across multiple risk categories.
Key Features: - 9 specialized risk analysis tools - Comprehensive risk scanner - AI-powered analysis using Google Gemini - Structured JSON outputs - Professional package architecture
- class pitchlense_mcp.BaseMCPTool(tool_name: str, description: str)[source]
Bases:
objectBase class for MCP tools with common functionality.
Provides shared methods and utilities for MCP tool implementations.
- create_error_response(error_message: str) Dict[str, Any][source]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- class pitchlense_mcp.BaseRiskAnalyzer(llm_client, category_name: str)[source]
Bases:
ABCAbstract base class for all risk analyzers.
Provides common functionality and interface for risk analysis tools.
- analyze(startup_data: str) Dict[str, Any][source]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.CompetitiveRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerCompetitive risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.CompetitiveRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for competitive risk analysis.
- analyze_competitive_risks(startup_data: str) dict[source]
Analyze competitive risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with competitive risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.ComprehensiveRiskScanner(api_key: str = None)[source]
Bases:
BaseMCPToolComprehensive risk scanner that combines all individual analyzers.
- calculate_overall_risk_level(category_scores: List[int]) tuple[source]
Calculate overall risk level and score from category scores.
- comprehensive_startup_risk_analysis(startup_data: str) dict[source]
Perform comprehensive startup risk analysis across all risk categories.
- Parameters:
startup_data – Unstructured startup information as a single string
- Returns:
JSON response with comprehensive risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- quick_risk_assessment(startup_data: str) dict[source]
Perform a quick risk assessment focusing on the most critical risk indicators.
- Parameters:
startup_data – Unstructured startup information as a single string
- Returns:
JSON response with quick risk assessment
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.CustomerRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerCustomer risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.CustomerRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for customer risk analysis.
- analyze_customer_risks(startup_data: str) dict[source]
Analyze customer-related risks for a startup.
- Parameters:
startup_data – String containing comprehensive startup information including company details, business model, financial data, market info, team details, news articles, pitch deck content, and web research
- Returns:
JSON response with customer risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.ExitRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerExit risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.ExitRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for exit risk analysis.
- analyze_exit_risks(startup_data: str) dict[source]
Analyze exit risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with exit risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.FinancialRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerFinancial risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.FinancialRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for financial risk analysis.
- analyze_financial_risks(startup_data: str) dict[source]
Analyze financial risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with financial risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.GeminiLLM(api_key: str | None = None, model: str = 'gemini-2.5-flash')[source]
Bases:
BaseLLMComprehensive Google Gemini LLM integration for PitchLense.
Provides unified access to all Gemini capabilities including text generation, image analysis, video analysis, audio analysis, and document analysis.
- predict(system_message: str, user_message: str, image_base64: str | None = None) Dict[str, Any][source]
Generate text prediction with optional image analysis.
- Parameters:
system_message – System instruction for the model
user_message – User’s input message
image_base64 – Optional base64 encoded image
- Returns:
Dictionary containing the response and usage information
- class pitchlense_mcp.LegalRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerLegal risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.LegalRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for legal risk analysis.
- analyze_legal_risks(startup_data: str) dict[source]
Analyze legal risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with legal risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.MarketRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerMarket risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.MarketRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for market risk analysis.
- analyze_market_risks(startup_data: str) dict[source]
Analyze market-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with market risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.OperationalRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerOperational risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.OperationalRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for operational risk analysis.
- analyze_operational_risks(startup_data: str) dict[source]
Analyze operational risks for a startup.
- Parameters:
startup_data – String containing comprehensive startup information including company details, business model, financial data, market info, team details, news articles, pitch deck content, and web research
- Returns:
JSON response with operational risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.PeerBenchmarkAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerAnalyzer for peer benchmarking.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.PeerBenchmarkMCPTool[source]
Bases:
BaseMCPToolMCP tool for peer benchmarking analysis.
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.PerplexityMCPTool[source]
Bases:
BaseMCPToolMCP tool that queries Perplexity and returns answer with source URLs.
- Parameters:
query – User query string to search on Perplexity.
model – Perplexity model to use (default: “sonar-small-online”).
- Returns:
“query”: original query string
”answer”: synthesized answer (str or None)
”sources”: list of {“url”, “title”}
- Return type:
A dictionary with keys
- API_URL = 'https://api.perplexity.ai/chat/completions'
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- search_perplexity(query: str, model: str = 'sonar-small-online') Dict[str, Any][source]
Query Perplexity for a given query.
- Parameters:
query – user query string
model – Perplexity model (default: sonar-small-online)
- Returns:
query, answer, sources (list of {url, title})
- Return type:
dict with keys
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.ProductRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerProduct risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.ProductRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for product risk analysis.
- analyze_product_risks(startup_data: str) dict[source]
Analyze product-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with product risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.RiskCategory(*, category_name: str, overall_risk_level: RiskLevel, category_score: Annotated[int, Ge(ge=1), Le(le=10)], indicators: List[RiskIndicator], summary: str)[source]
Bases:
BaseModelModel for risk categories containing multiple indicators.
- category_name: str
- category_score: int
- classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) Self
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use model_copy instead.
If you need include or exclude, use:
`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include – Optional set or mapping specifying which fields to include in the copied model.
exclude – Optional set or mapping specifying which fields to exclude in the copied model.
update – Optional dictionary of field-value pairs to override field values in the copied model.
deep – If True, the values of fields that are Pydantic models will be deep-copied.
- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
- classmethod from_orm(obj: Any) Self
- indicators: List[RiskIndicator]
- json(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
- model_computed_fields = {}
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or None if config.extra is not set to “allow”.
- model_fields = {'category_name': FieldInfo(annotation=str, required=True, description='Name of the risk category'), 'category_score': FieldInfo(annotation=int, required=True, description='Average risk score for this category', metadata=[Ge(ge=1), Le(le=10)]), 'indicators': FieldInfo(annotation=List[RiskIndicator], required=True, description='List of risk indicators in this category'), 'overall_risk_level': FieldInfo(annotation=RiskLevel, required=True, description='Overall risk level for this category'), 'summary': FieldInfo(annotation=str, required=True, description='Summary of risks in this category')}
- property model_fields_set: set[str]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}', schema_generator: type[~pydantic.json_schema.GenerateJsonSchema] = <class 'pydantic.json_schema.GenerateJsonSchema'>, mode: ~typing.Literal['validation', 'serialization'] = 'validation') dict[str, Any]
Generates a JSON schema for a model class.
- Parameters:
by_alias – Whether to use attribute aliases or not.
ref_template – The reference template.
schema_generator – To override the logic used to generate the JSON schema, as a subclass of GenerateJsonSchema with your desired modifications
mode – The mode in which to generate the schema.
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params – Tuple of types of the class. Given a generic class Model with 2 type variables and a concrete model Model[str, int], the value (str, int) would be passed to params.
- Returns:
String representing the new class where params are passed to cls as type variables.
- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context: Any, /) None
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: MappingNamespace | None = None) bool | None
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force – Whether to force the rebuilding of the model schema, defaults to False.
raise_errors – Whether to raise errors, defaults to True.
_parent_namespace_depth – The depth level of the parent namespace, defaults to 2.
_types_namespace – The types namespace, defaults to None.
- Returns:
Returns None if the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returns True if rebuilding was successful, otherwise False.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- classmethod parse_obj(obj: Any) Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- classmethod schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}') Dict[str, Any]
- classmethod schema_json(*, by_alias: bool = True, ref_template: str = '#/$defs/{model}', **dumps_kwargs: Any) str
- summary: str
- classmethod update_forward_refs(**localns: Any) None
- classmethod validate(value: Any) Self
- class pitchlense_mcp.RiskIndicator(*, indicator: str, risk_level: RiskLevel, score: Annotated[int, Ge(ge=1), Le(le=10)], description: str, recommendation: str)[source]
Bases:
BaseModelModel for individual risk indicators.
- classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) Self
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use model_copy instead.
If you need include or exclude, use:
`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include – Optional set or mapping specifying which fields to include in the copied model.
exclude – Optional set or mapping specifying which fields to exclude in the copied model.
update – Optional dictionary of field-value pairs to override field values in the copied model.
deep – If True, the values of fields that are Pydantic models will be deep-copied.
- Returns:
A copy of the model with included, excluded and updated fields as specified.
- description: str
- dict(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
- classmethod from_orm(obj: Any) Self
- indicator: str
- json(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
- model_computed_fields = {}
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or None if config.extra is not set to “allow”.
- model_fields = {'description': FieldInfo(annotation=str, required=True, description='Detailed description of the risk'), 'indicator': FieldInfo(annotation=str, required=True, description='The specific risk indicator'), 'recommendation': FieldInfo(annotation=str, required=True, description='Recommended action to mitigate risk'), 'risk_level': FieldInfo(annotation=RiskLevel, required=True, description='Risk level assessment'), 'score': FieldInfo(annotation=int, required=True, description='Risk score from 1-10', metadata=[Ge(ge=1), Le(le=10)])}
- property model_fields_set: set[str]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}', schema_generator: type[~pydantic.json_schema.GenerateJsonSchema] = <class 'pydantic.json_schema.GenerateJsonSchema'>, mode: ~typing.Literal['validation', 'serialization'] = 'validation') dict[str, Any]
Generates a JSON schema for a model class.
- Parameters:
by_alias – Whether to use attribute aliases or not.
ref_template – The reference template.
schema_generator – To override the logic used to generate the JSON schema, as a subclass of GenerateJsonSchema with your desired modifications
mode – The mode in which to generate the schema.
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params – Tuple of types of the class. Given a generic class Model with 2 type variables and a concrete model Model[str, int], the value (str, int) would be passed to params.
- Returns:
String representing the new class where params are passed to cls as type variables.
- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context: Any, /) None
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: MappingNamespace | None = None) bool | None
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force – Whether to force the rebuilding of the model schema, defaults to False.
raise_errors – Whether to raise errors, defaults to True.
_parent_namespace_depth – The depth level of the parent namespace, defaults to 2.
_types_namespace – The types namespace, defaults to None.
- Returns:
Returns None if the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returns True if rebuilding was successful, otherwise False.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- classmethod parse_obj(obj: Any) Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- recommendation: str
- classmethod schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}') Dict[str, Any]
- classmethod schema_json(*, by_alias: bool = True, ref_template: str = '#/$defs/{model}', **dumps_kwargs: Any) str
- score: int
- classmethod update_forward_refs(**localns: Any) None
- classmethod validate(value: Any) Self
- class pitchlense_mcp.RiskLevel(*values)[source]
Bases:
str,EnumEnumeration of risk levels.
- CRITICAL = 'critical'
- HIGH = 'high'
- LOW = 'low'
- MEDIUM = 'medium'
- UNKNOWN = 'unknown'
- capitalize()
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()
Return True if all characters in the string are printable, False otherwise.
A character is printable if repr() may use it in its output.
- isspace()
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()
Return a copy of the string converted to uppercase.
- zfill(width, /)
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- class pitchlense_mcp.SerpNewsMCPTool[source]
Bases:
BaseMCPToolMCP tool to fetch Google News via SerpAPI for a query.
- Usage example:
>>> from pitchlense_mcp import SerpNewsMCPTool >>> tool = SerpNewsMCPTool() >>> result = tool.fetch_google_news("OpenAI funding round", num_results=10) >>> print(result["results"][0]["link"]) # first news URL
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- fetch_google_news(query: str, num_results: int = 10) Dict[str, Any][source]
Fetch Google News first page for a query.
- Parameters:
query – Search query string.
num_results – Maximum number of results to return (default: 10).
- Returns:
“query”: The original query string.
- ”results”: List of news items, each containing:
{“title”, “link”, “source”, “date”, “snippet”, “thumbnail”}.
- Return type:
A dictionary with keys
- Error handling:
Returns a standardized error dict via create_error_response on failures (e.g., missing API key, network error, or invalid input).
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
- class pitchlense_mcp.StartupData(*, name: str, description: str, industry: str, stage: str, team_size: int | None = None, founders: List[str] | None = None, funding_raised: float | None = None, revenue: float | None = None, customers: int | None = None, market_size: str | None = None, competitors: List[str] | None = None, additional_info: Dict[str, Any] | None = None)[source]
Bases:
BaseModelModel for startup input data.
- additional_info: Dict[str, Any] | None
- competitors: List[str] | None
- classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) Self
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use model_copy instead.
If you need include or exclude, use:
`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include – Optional set or mapping specifying which fields to include in the copied model.
exclude – Optional set or mapping specifying which fields to exclude in the copied model.
update – Optional dictionary of field-value pairs to override field values in the copied model.
deep – If True, the values of fields that are Pydantic models will be deep-copied.
- Returns:
A copy of the model with included, excluded and updated fields as specified.
- customers: int | None
- description: str
- dict(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
- founders: List[str] | None
- classmethod from_orm(obj: Any) Self
- funding_raised: float | None
- industry: str
- json(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
- market_size: str | None
- model_computed_fields = {}
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or None if config.extra is not set to “allow”.
- model_fields = {'additional_info': FieldInfo(annotation=Union[Dict[str, Any], NoneType], required=False, default=None, description='Additional relevant information'), 'competitors': FieldInfo(annotation=Union[List[str], NoneType], required=False, default=None, description='List of main competitors'), 'customers': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='Number of customers/users'), 'description': FieldInfo(annotation=str, required=True, description='Business description'), 'founders': FieldInfo(annotation=Union[List[str], NoneType], required=False, default=None, description='List of founder names'), 'funding_raised': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='Total funding raised in USD'), 'industry': FieldInfo(annotation=str, required=True, description='Industry/sector'), 'market_size': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Target market size description'), 'name': FieldInfo(annotation=str, required=True, description='Startup name'), 'revenue': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='Annual revenue in USD'), 'stage': FieldInfo(annotation=str, required=True, description='Development stage (idea, MVP, growth, etc.)'), 'team_size': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='Number of team members')}
- property model_fields_set: set[str]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}', schema_generator: type[~pydantic.json_schema.GenerateJsonSchema] = <class 'pydantic.json_schema.GenerateJsonSchema'>, mode: ~typing.Literal['validation', 'serialization'] = 'validation') dict[str, Any]
Generates a JSON schema for a model class.
- Parameters:
by_alias – Whether to use attribute aliases or not.
ref_template – The reference template.
schema_generator – To override the logic used to generate the JSON schema, as a subclass of GenerateJsonSchema with your desired modifications
mode – The mode in which to generate the schema.
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params – Tuple of types of the class. Given a generic class Model with 2 type variables and a concrete model Model[str, int], the value (str, int) would be passed to params.
- Returns:
String representing the new class where params are passed to cls as type variables.
- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context: Any, /) None
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: MappingNamespace | None = None) bool | None
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force – Whether to force the rebuilding of the model schema, defaults to False.
raise_errors – Whether to raise errors, defaults to True.
_parent_namespace_depth – The depth level of the parent namespace, defaults to 2.
_types_namespace – The types namespace, defaults to None.
- Returns:
Returns None if the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returns True if rebuilding was successful, otherwise False.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- name: str
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- classmethod parse_obj(obj: Any) Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- revenue: float | None
- classmethod schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}') Dict[str, Any]
- classmethod schema_json(*, by_alias: bool = True, ref_template: str = '#/$defs/{model}', **dumps_kwargs: Any) str
- stage: str
- team_size: int | None
- classmethod update_forward_refs(**localns: Any) None
- classmethod validate(value: Any) Self
- class pitchlense_mcp.StartupRiskAnalysis(*, startup_name: str, overall_risk_level: RiskLevel, overall_score: Annotated[int, Ge(ge=1), Le(le=10)], risk_categories: List[RiskCategory], key_concerns: List[str], investment_recommendation: str, confidence_score: Annotated[float, Ge(ge=0.0), Le(le=1.0)], analysis_metadata: Dict[str, Any] | None = None)[source]
Bases:
BaseModelModel for comprehensive startup risk analysis results.
- analysis_metadata: Dict[str, Any] | None
- confidence_score: float
- classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) Self
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use model_copy instead.
If you need include or exclude, use:
`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include – Optional set or mapping specifying which fields to include in the copied model.
exclude – Optional set or mapping specifying which fields to exclude in the copied model.
update – Optional dictionary of field-value pairs to override field values in the copied model.
deep – If True, the values of fields that are Pydantic models will be deep-copied.
- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
- classmethod from_orm(obj: Any) Self
- investment_recommendation: str
- json(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
- key_concerns: List[str]
- model_computed_fields = {}
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self
- !!! abstract “Usage Documentation”
[model_copy](../concepts/serialization.md#model_copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- Parameters:
update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.
deep – Set to True to make a deep copy of the model.
- Returns:
New model instance.
- model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) dict[str, Any]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#modelmodel_dump)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or None if config.extra is not set to “allow”.
- model_fields = {'analysis_metadata': FieldInfo(annotation=Union[Dict[str, Any], NoneType], required=False, default=None, description='Additional analysis metadata'), 'confidence_score': FieldInfo(annotation=float, required=True, description='Confidence in the analysis (0.0-1.0)', metadata=[Ge(ge=0.0), Le(le=1.0)]), 'investment_recommendation': FieldInfo(annotation=str, required=True, description='Investment recommendation based on analysis'), 'key_concerns': FieldInfo(annotation=List[str], required=True, description='Top 5 key concerns identified'), 'overall_risk_level': FieldInfo(annotation=RiskLevel, required=True, description='Overall risk level assessment'), 'overall_score': FieldInfo(annotation=int, required=True, description='Overall risk score from 1-10', metadata=[Ge(ge=1), Le(le=10)]), 'risk_categories': FieldInfo(annotation=List[RiskCategory], required=True, description='List of risk categories analyzed'), 'startup_name': FieldInfo(annotation=str, required=True, description='Name of the startup being analyzed')}
- property model_fields_set: set[str]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}', schema_generator: type[~pydantic.json_schema.GenerateJsonSchema] = <class 'pydantic.json_schema.GenerateJsonSchema'>, mode: ~typing.Literal['validation', 'serialization'] = 'validation') dict[str, Any]
Generates a JSON schema for a model class.
- Parameters:
by_alias – Whether to use attribute aliases or not.
ref_template – The reference template.
schema_generator – To override the logic used to generate the JSON schema, as a subclass of GenerateJsonSchema with your desired modifications
mode – The mode in which to generate the schema.
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params – Tuple of types of the class. Given a generic class Model with 2 type variables and a concrete model Model[str, int], the value (str, int) would be passed to params.
- Returns:
String representing the new class where params are passed to cls as type variables.
- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context: Any, /) None
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: MappingNamespace | None = None) bool | None
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force – Whether to force the rebuilding of the model schema, defaults to False.
raise_errors – Whether to raise errors, defaults to True.
_parent_namespace_depth – The depth level of the parent namespace, defaults to 2.
_types_namespace – The types namespace, defaults to None.
- Returns:
Returns None if the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returns True if rebuilding was successful, otherwise False.
- classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate a pydantic model instance.
- Parameters:
obj – The object to validate.
strict – Whether to enforce types strictly.
from_attributes – Whether to extract data from object attributes.
context – Additional context to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Returns:
The validated model instance.
- classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data – The JSON data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If json_data is not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- overall_score: int
- classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- classmethod parse_obj(obj: Any) Self
- classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
- risk_categories: List[RiskCategory]
- classmethod schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}') Dict[str, Any]
- classmethod schema_json(*, by_alias: bool = True, ref_template: str = '#/$defs/{model}', **dumps_kwargs: Any) str
- startup_name: str
- classmethod update_forward_refs(**localns: Any) None
- classmethod validate(value: Any) Self
- class pitchlense_mcp.TeamRiskAnalyzer(llm_client)[source]
Bases:
BaseRiskAnalyzerTeam risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.TeamRiskMCPTool[source]
Bases:
BaseMCPToolMCP tool for team risk analysis.
- analyze_team_risks(startup_data: str) dict[source]
Analyze team-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with team risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Analyzers
Market Risk Analyzer for PitchLense MCP Package.
Analyzes market-related risks including TAM, growth rate, competition, and differentiation.
- class pitchlense_mcp.analyzers.market_risk.MarketRiskAnalyzer(llm_client)[source]
Market risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.market_risk.MarketRiskMCPTool[source]
MCP tool for market risk analysis.
- analyze_market_risks(startup_data: str) dict[source]
Analyze market-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with market risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Product Risk Analyzer for PitchLense MCP Package.
Analyzes product-related risks including development stage, market fit, technical feasibility, IP protection, and scalability.
- class pitchlense_mcp.analyzers.product_risk.ProductRiskAnalyzer(llm_client)[source]
Product risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.product_risk.ProductRiskMCPTool[source]
MCP tool for product risk analysis.
- analyze_product_risks(startup_data: str) dict[source]
Analyze product-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with product risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Team Risk Analyzer for PitchLense MCP Package.
Analyzes team and founder-related risks including leadership depth, founder stability, skill gaps, and credibility.
- class pitchlense_mcp.analyzers.team_risk.TeamRiskAnalyzer(llm_client)[source]
Team risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.team_risk.TeamRiskMCPTool[source]
MCP tool for team risk analysis.
- analyze_team_risks(startup_data: str) dict[source]
Analyze team-related risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with team risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Financial Risk Analyzer for PitchLense MCP Package.
Analyzes financial risks including metrics consistency, burn rate, projections, CAC/LTV ratio, and profitability path.
- class pitchlense_mcp.analyzers.financial_risk.FinancialRiskAnalyzer(llm_client)[source]
Financial risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.financial_risk.FinancialRiskMCPTool[source]
MCP tool for financial risk analysis.
- analyze_financial_risks(startup_data: str) dict[source]
Analyze financial risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with financial risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Customer Risk Analyzer for PitchLense MCP Package.
Analyzes customer and traction-related risks including traction levels, churn rate, retention, and customer concentration.
- class pitchlense_mcp.analyzers.customer_risk.CustomerRiskAnalyzer(llm_client)[source]
Customer risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.customer_risk.CustomerRiskMCPTool[source]
MCP tool for customer risk analysis.
- analyze_customer_risks(startup_data: str) dict[source]
Analyze customer-related risks for a startup.
- Parameters:
startup_data – String containing comprehensive startup information including company details, business model, financial data, market info, team details, news articles, pitch deck content, and web research
- Returns:
JSON response with customer risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Operational Risk Analyzer for PitchLense MCP Package.
Analyzes operational risks including supply chain, go-to-market strategy, operational efficiency, and execution history.
- class pitchlense_mcp.analyzers.operational_risk.OperationalRiskAnalyzer(llm_client)[source]
Operational risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.operational_risk.OperationalRiskMCPTool[source]
MCP tool for operational risk analysis.
- analyze_operational_risks(startup_data: str) dict[source]
Analyze operational risks for a startup.
- Parameters:
startup_data – String containing comprehensive startup information including company details, business model, financial data, market info, team details, news articles, pitch deck content, and web research
- Returns:
JSON response with operational risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Competitive Risk Analyzer for PitchLense MCP Package.
Analyzes competitive risks including incumbent strength, entry barriers, and defensibility.
- class pitchlense_mcp.analyzers.competitive_risk.CompetitiveRiskAnalyzer(llm_client)[source]
Competitive risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.competitive_risk.CompetitiveRiskMCPTool[source]
MCP tool for competitive risk analysis.
- analyze_competitive_risks(startup_data: str) dict[source]
Analyze competitive risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with competitive risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Legal Risk Analyzer for PitchLense MCP Package.
Analyzes legal and regulatory risks including regulatory environment, compliance issues, and legal disputes.
- class pitchlense_mcp.analyzers.legal_risk.LegalRiskAnalyzer(llm_client)[source]
Legal risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.legal_risk.LegalRiskMCPTool[source]
MCP tool for legal risk analysis.
- analyze_legal_risks(startup_data: str) dict[source]
Analyze legal risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with legal risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Exit Risk Analyzer for PitchLense MCP Package.
Analyzes exit risks including exit pathways, sector exit activity, and late-stage investor appeal.
- class pitchlense_mcp.analyzers.exit_risk.ExitRiskAnalyzer(llm_client)[source]
Exit risk analyzer implementation.
- analyze(startup_data: str) Dict[str, Any]
Perform risk analysis for the given startup data.
- Parameters:
startup_data – String containing comprehensive startup information
- Returns:
Dictionary containing risk analysis results
- class pitchlense_mcp.analyzers.exit_risk.ExitRiskMCPTool[source]
MCP tool for exit risk analysis.
- analyze_exit_risks(startup_data: str) dict[source]
Analyze exit risks for a startup.
- Parameters:
startup_data – Dictionary containing startup information
- Returns:
JSON response with exit risk analysis
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Tools
SerpAPI Google News MCP tool.
This tool queries Google News via SerpAPI and returns a normalized list of news results (first page) containing title, link, source, date, snippet, and thumbnail when available.
- Environment variables:
SERPAPI_API_KEY: API key for SerpAPI (required).
- class pitchlense_mcp.tools.serp_news.SerpNewsMCPTool[source]
MCP tool to fetch Google News via SerpAPI for a query.
- Usage example:
>>> from pitchlense_mcp import SerpNewsMCPTool >>> tool = SerpNewsMCPTool() >>> result = tool.fetch_google_news("OpenAI funding round", num_results=10) >>> print(result["results"][0]["link"]) # first news URL
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- fetch_google_news(query: str, num_results: int = 10) Dict[str, Any][source]
Fetch Google News first page for a query.
- Parameters:
query – Search query string.
num_results – Maximum number of results to return (default: 10).
- Returns:
“query”: The original query string.
- ”results”: List of news items, each containing:
{“title”, “link”, “source”, “date”, “snippet”, “thumbnail”}.
- Return type:
A dictionary with keys
- Error handling:
Returns a standardized error dict via create_error_response on failures (e.g., missing API key, network error, or invalid input).
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise
Perplexity search MCP tool.
This tool calls Perplexity’s Chat Completions API with a user query and returns a JSON containing the synthesized answer and a list of source URLs (and titles when available).
- Environment variables:
PERPLEXITY_API_KEY: API key for Perplexity (required).
- class pitchlense_mcp.tools.perplexity_search.PerplexityMCPTool[source]
MCP tool that queries Perplexity and returns answer with source URLs.
- Parameters:
query – User query string to search on Perplexity.
model – Perplexity model to use (default: “sonar-small-online”).
- Returns:
“query”: original query string
”answer”: synthesized answer (str or None)
”sources”: list of {“url”, “title”}
- Return type:
A dictionary with keys
- API_URL = 'https://api.perplexity.ai/chat/completions'
- create_error_response(error_message: str) Dict[str, Any]
Create a standardized error response.
- Parameters:
error_message – Error message to include
- Returns:
Standardized error response dictionary
- register_tool(func)
Register a function as an MCP tool.
- Parameters:
func – Function to register as MCP tool
- run()
Run the MCP server.
- search_perplexity(query: str, model: str = 'sonar-small-online') Dict[str, Any][source]
Query Perplexity for a given query.
- Parameters:
query – user query string
model – Perplexity model (default: sonar-small-online)
- Returns:
query, answer, sources (list of {url, title})
- Return type:
dict with keys
- validate_startup_data(startup_data: str) bool
Validate startup data format.
- Parameters:
startup_data – String containing startup information
- Returns:
True if data is valid, False otherwise